[AX.25] Added option to adjust audio frequencies (#346)
This commit is contained in:
parent
8c66edc03e
commit
6460d566cd
4 changed files with 40 additions and 2 deletions
|
@ -74,6 +74,22 @@ void setup() {
|
||||||
Serial.println(state);
|
Serial.println(state);
|
||||||
while(true);
|
while(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sometimes, it may be required to adjust audio
|
||||||
|
// frequencies to match the expected 1200/2200 Hz tones.
|
||||||
|
// The following method will offset mark frequency by
|
||||||
|
// 100 Hz up and space frequency by 100 Hz down
|
||||||
|
/*
|
||||||
|
Serial.print(F("[AX.25] Setting correction ... "));
|
||||||
|
state = ax25.setCorrection(100, -100);
|
||||||
|
if(state == ERR_NONE) {
|
||||||
|
Serial.println(F("success!"));
|
||||||
|
} else {
|
||||||
|
Serial.print(F("failed, code "));
|
||||||
|
Serial.println(state);
|
||||||
|
while(true);
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
|
@ -230,6 +230,7 @@ setRepeaters KEYWORD2
|
||||||
setRecvSequence KEYWORD2
|
setRecvSequence KEYWORD2
|
||||||
setSendSequence KEYWORD2
|
setSendSequence KEYWORD2
|
||||||
sendFrame KEYWORD2
|
sendFrame KEYWORD2
|
||||||
|
setCorrection KEYWORD2
|
||||||
|
|
||||||
# SSTV
|
# SSTV
|
||||||
sendHeader KEYWORD2
|
sendHeader KEYWORD2
|
||||||
|
|
|
@ -160,6 +160,14 @@ AX25Client::AX25Client(PhysicalLayer* phy) {
|
||||||
AX25Client::AX25Client(AFSKClient* audio) {
|
AX25Client::AX25Client(AFSKClient* audio) {
|
||||||
_phy = audio->_phy;
|
_phy = audio->_phy;
|
||||||
_audio = audio;
|
_audio = audio;
|
||||||
|
_afskMark = AX25_AFSK_MARK;
|
||||||
|
_afskSpace = AX25_AFSK_SPACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t AX25Client::setCorrection(int16_t mark, int16_t space) {
|
||||||
|
_afskMark = AX25_AFSK_MARK + mark;
|
||||||
|
_afskSpace = AX25_AFSK_SPACE + space;
|
||||||
|
return(ERR_NONE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -393,9 +401,9 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
|
||||||
for(uint16_t mask = 0x80; mask >= 0x01; mask >>= 1) {
|
for(uint16_t mask = 0x80; mask >= 0x01; mask >>= 1) {
|
||||||
uint32_t start = Module::micros();
|
uint32_t start = Module::micros();
|
||||||
if(stuffedFrameBuff[i] & mask) {
|
if(stuffedFrameBuff[i] & mask) {
|
||||||
_audio->tone(AX25_AFSK_MARK, false);
|
_audio->tone(_afskMark, false);
|
||||||
} else {
|
} else {
|
||||||
_audio->tone(AX25_AFSK_SPACE, false);
|
_audio->tone(_afskSpace, false);
|
||||||
}
|
}
|
||||||
while(Module::micros() - start < AX25_AFSK_TONE_DURATION) {
|
while(Module::micros() - start < AX25_AFSK_TONE_DURATION) {
|
||||||
Module::yield();
|
Module::yield();
|
||||||
|
|
|
@ -292,6 +292,17 @@ class AX25Client {
|
||||||
\param audio Pointer to the AFSK instance providing audio.
|
\param audio Pointer to the AFSK instance providing audio.
|
||||||
*/
|
*/
|
||||||
explicit AX25Client(AFSKClient* audio);
|
explicit AX25Client(AFSKClient* audio);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Set AFSK tone correction offset. On some platforms, this is required to get the audio produced by the setup to match the expected 1200/2200 Hz tones.
|
||||||
|
|
||||||
|
\param mark Positive or negative correction offset for mark audio frequency in Hz.
|
||||||
|
|
||||||
|
\param space Positive or negative correction offset for space audio frequency in Hz.
|
||||||
|
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t setCorrection(int16_t mark, int16_t space);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// basic methods
|
// basic methods
|
||||||
|
@ -337,6 +348,8 @@ class AX25Client {
|
||||||
PhysicalLayer* _phy;
|
PhysicalLayer* _phy;
|
||||||
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
#if !defined(RADIOLIB_EXCLUDE_AFSK)
|
||||||
AFSKClient* _audio;
|
AFSKClient* _audio;
|
||||||
|
uint32_t _afskMark;
|
||||||
|
uint32_t _afskSpace;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};
|
char _srcCallsign[AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
Loading…
Add table
Reference in a new issue