[AX25] Fixed exclusion macros

This commit is contained in:
jgromes 2020-07-04 21:18:40 +02:00
parent 4ca26f6e47
commit 152d3d3da3
2 changed files with 18 additions and 6 deletions

View file

@ -112,7 +112,9 @@ void AX25Frame::setSendSequence(uint8_t seqNumber) {
AX25Client::AX25Client(PhysicalLayer* phy) { AX25Client::AX25Client(PhysicalLayer* phy) {
_phy = phy; _phy = phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK)
_audio = nullptr; _audio = nullptr;
#endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
@ -140,12 +142,14 @@ int16_t AX25Client::begin(const char* srcCallsign, uint8_t srcSSID, uint8_t prea
// set module frequency deviation to 0 if using FSK // set module frequency deviation to 0 if using FSK
int16_t state = ERR_NONE; int16_t state = ERR_NONE;
#if !defined(RADIOLIB_EXCLUDE_AFSK)
if(_audio == nullptr) { if(_audio == nullptr) {
state = _phy->setFrequencyDeviation(0); state = _phy->setFrequencyDeviation(0);
RADIOLIB_ASSERT(state); RADIOLIB_ASSERT(state);
state = _phy->setEncoding(0); state = _phy->setEncoding(0);
} }
#endif
return(state); return(state);
} }
@ -348,9 +352,8 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
// transmit // transmit
int16_t state = ERR_NONE; int16_t state = ERR_NONE;
if(_audio == nullptr) { #if !defined(RADIOLIB_EXCLUDE_AFSK)
state = _phy->transmit(stuffedFrameBuff, stuffedFrameBuffLen); if(_audio != nullptr) {
} else {
_phy->transmitDirect(); _phy->transmitDirect();
// iterate over all bytes in the buffer // iterate over all bytes in the buffer
@ -372,7 +375,13 @@ int16_t AX25Client::sendFrame(AX25Frame* frame) {
} }
_audio->noTone(); _audio->noTone();
} else {
#endif
state = _phy->transmit(stuffedFrameBuff, stuffedFrameBuffLen);
#if !defined(RADIOLIB_EXCLUDE_AFSK)
} }
#endif
// deallocate memory // deallocate memory
#ifndef RADIOLIB_STATIC_ONLY #ifndef RADIOLIB_STATIC_ONLY

View file

@ -1,7 +1,10 @@
#if !defined(_RADIOLIB_AX25_H) && !defined(RADIOLIB_EXCLUDE_AX25) #if !defined(_RADIOLIB_AX25_H)
#define _RADIOLIB_AX25_H #define _RADIOLIB_AX25_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_AX25)
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -320,8 +323,6 @@ class AX25Client {
PhysicalLayer* _phy; PhysicalLayer* _phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
AFSKClient* _audio; AFSKClient* _audio;
#else
void* _audio;
#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};
@ -334,3 +335,5 @@ class AX25Client {
}; };
#endif #endif
#endif