[AX25] Added option to modify tone length for AFSK mode

This commit is contained in:
jgromes 2022-10-23 10:18:49 +02:00
parent b903ddabc6
commit 67937f4f46
2 changed files with 8 additions and 3 deletions

View file

@ -163,11 +163,13 @@ AX25Client::AX25Client(AFSKClient* audio) {
_audio = audio; _audio = audio;
_afskMark = RADIOLIB_AX25_AFSK_MARK; _afskMark = RADIOLIB_AX25_AFSK_MARK;
_afskSpace = RADIOLIB_AX25_AFSK_SPACE; _afskSpace = RADIOLIB_AX25_AFSK_SPACE;
_afskLen = RADIOLIB_AX25_AFSK_TONE_DURATION;
} }
int16_t AX25Client::setCorrection(int16_t mark, int16_t space) { int16_t AX25Client::setCorrection(int16_t mark, int16_t space, float length) {
_afskMark = RADIOLIB_AX25_AFSK_MARK + mark; _afskMark = RADIOLIB_AX25_AFSK_MARK + mark;
_afskSpace = RADIOLIB_AX25_AFSK_SPACE + space; _afskSpace = RADIOLIB_AX25_AFSK_SPACE + space;
_afskLen = length*(float)RADIOLIB_AX25_AFSK_TONE_DURATION;
return(RADIOLIB_ERR_NONE); return(RADIOLIB_ERR_NONE);
} }
#endif #endif
@ -411,7 +413,7 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
} else { } else {
_audio->tone(_afskSpace, false); _audio->tone(_afskSpace, false);
} }
while(mod->micros() - start < RADIOLIB_AX25_AFSK_TONE_DURATION) { while(mod->micros() - start < _afskLen) {
mod->yield(); mod->yield();
} }
} }

View file

@ -300,9 +300,11 @@ class AX25Client {
\param space Positive or negative correction offset for space audio frequency in Hz. \param space Positive or negative correction offset for space audio frequency in Hz.
\param length Audio tone length modifier, defaults to 1.0.
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setCorrection(int16_t mark, int16_t space); int16_t setCorrection(int16_t mark, int16_t space, float length = 1.0f);
#endif #endif
// basic methods // basic methods
@ -365,6 +367,7 @@ class AX25Client {
AFSKClient* _audio; AFSKClient* _audio;
uint32_t _afskMark; uint32_t _afskMark;
uint32_t _afskSpace; uint32_t _afskSpace;
uint32_t _afskLen;
#endif #endif
char _srcCallsign[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0}; char _srcCallsign[RADIOLIB_AX25_MAX_CALLSIGN_LEN + 1] = {0, 0, 0, 0, 0, 0, 0};