[RTTY] Fixed exclusion macros

This commit is contained in:
jgromes 2020-07-04 21:19:23 +02:00
parent 27471fd788
commit dabac56cc4
2 changed files with 16 additions and 7 deletions

View file

@ -107,7 +107,9 @@ uint16_t ITA2String::getBits(char c) {
RTTYClient::RTTYClient(PhysicalLayer* phy) { RTTYClient::RTTYClient(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)
@ -161,9 +163,11 @@ int16_t RTTYClient::begin(float base, uint32_t shift, uint16_t rate, uint8_t enc
// 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);
} }
#endif
return(state); return(state);
} }
@ -520,19 +524,21 @@ size_t RTTYClient::printFloat(double number, uint8_t digits) {
} }
int16_t RTTYClient::transmitDirect(uint32_t freq, uint32_t freqHz) { int16_t RTTYClient::transmitDirect(uint32_t freq, uint32_t freqHz) {
#if !defined(RADIOLIB_EXCLUDE_AFSK)
if(_audio != nullptr) { if(_audio != nullptr) {
return(_audio->tone(freqHz)); return(_audio->tone(freqHz));
} else {
return(_phy->transmitDirect(freq));
} }
#endif
return(_phy->transmitDirect(freq));
} }
int16_t RTTYClient::standby() { int16_t RTTYClient::standby() {
#if !defined(RADIOLIB_EXCLUDE_AFSK)
if(_audio != nullptr) { if(_audio != nullptr) {
return(_audio->noTone()); return(_audio->noTone());
} else {
return(_phy->standby());
} }
#endif
return(_phy->standby());
} }
#endif #endif

View file

@ -1,7 +1,10 @@
#if !defined(_RADIOLIB_RTTY_H) && !defined(RADIOLIB_EXCLUDE_RTTY) #if !defined(_RADIOLIB_RTTY_H)
#define _RADIOLIB_RTTY_H #define _RADIOLIB_RTTY_H
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RTTY)
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -159,8 +162,6 @@ class RTTYClient {
PhysicalLayer* _phy; PhysicalLayer* _phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !defined(RADIOLIB_EXCLUDE_AFSK)
AFSKClient* _audio; AFSKClient* _audio;
#else
void* _audio;
#endif #endif
uint8_t _encoding = ASCII; uint8_t _encoding = ASCII;
@ -181,3 +182,5 @@ class RTTYClient {
}; };
#endif #endif
#endif