From a5db0c02bf2d3c9d4bde534a17b877b805f46a67 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 4 Jul 2020 21:19:30 +0200 Subject: [PATCH] [SSTV] Fixed exclusion macros --- src/protocols/SSTV/SSTV.cpp | 10 ++++++++++ src/protocols/SSTV/SSTV.h | 11 ++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/protocols/SSTV/SSTV.cpp b/src/protocols/SSTV/SSTV.cpp index 6e658a25..9fc9fd3e 100644 --- a/src/protocols/SSTV/SSTV.cpp +++ b/src/protocols/SSTV/SSTV.cpp @@ -156,7 +156,9 @@ const SSTVMode_t PasokonP7 { SSTVClient::SSTVClient(PhysicalLayer* phy) { _phy = phy; + #if !defined(RADIOLIB_EXCLUDE_AFSK) _audio = nullptr; + #endif } #if !defined(RADIOLIB_EXCLUDE_AFSK) @@ -166,6 +168,7 @@ SSTVClient::SSTVClient(AFSKClient* audio) { } #endif +#if !defined(RADIOLIB_EXCLUDE_AFSK) int16_t SSTVClient::begin(const SSTVMode_t& mode, float correction) { if(_audio == nullptr) { // this initialization method can only be used in AFSK mode @@ -174,6 +177,7 @@ int16_t SSTVClient::begin(const SSTVMode_t& mode, float correction) { return(begin(0, mode, correction)); } +#endif int16_t SSTVClient::begin(float base, const SSTVMode_t& mode, float correction) { // save mode @@ -190,9 +194,11 @@ int16_t SSTVClient::begin(float base, const SSTVMode_t& mode, float correction) // set module frequency deviation to 0 if using FSK int16_t state = ERR_NONE; + #if !defined(RADIOLIB_EXCLUDE_AFSK) if(_audio == nullptr) { state = _phy->setFrequencyDeviation(0); } + #endif return(state); } @@ -284,11 +290,15 @@ uint16_t SSTVClient::getPictureHeight() const { void SSTVClient::tone(float freq, uint32_t len) { uint32_t start = micros(); + #if !defined(RADIOLIB_EXCLUDE_AFSK) if(_audio != nullptr) { _audio->tone(freq, false); } else { _phy->transmitDirect(_base + (freq / _phy->getFreqStep())); } + #else + _phy->transmitDirect(_base + (freq / _phy->getFreqStep())); + #endif while(micros() - start < len) { yield(); } diff --git a/src/protocols/SSTV/SSTV.h b/src/protocols/SSTV/SSTV.h index fd827b6a..fb8fc27a 100644 --- a/src/protocols/SSTV/SSTV.h +++ b/src/protocols/SSTV/SSTV.h @@ -1,7 +1,10 @@ -#if !defined(_RADIOLIB_SSTV_H) && !defined(RADIOLIB_EXCLUDE_SSTV) +#if !defined(_RADIOLIB_SSTV_H) #define _RADIOLIB_SSTV_H #include "../../TypeDef.h" + +#if !defined(RADIOLIB_EXCLUDE_SSTV) + #include "../PhysicalLayer/PhysicalLayer.h" #include "../AFSK/AFSK.h" @@ -147,6 +150,7 @@ class SSTVClient { */ int16_t begin(float base, const SSTVMode_t& mode, float correction = 1.0); + #if !defined(RADIOLIB_EXCLUDE_AFSK) /*! \brief Initialization method for AFSK. @@ -157,6 +161,7 @@ class SSTVClient { \returns \ref status_codes */ int16_t begin(const SSTVMode_t& mode, float correction = 1.0); + #endif /*! \brief Sends out tone at 1900 Hz. @@ -188,8 +193,6 @@ class SSTVClient { PhysicalLayer* _phy; #if !defined(RADIOLIB_EXCLUDE_AFSK) AFSKClient* _audio; - #else - void* _audio; #endif uint32_t _base = 0; @@ -200,3 +203,5 @@ class SSTVClient { }; #endif + +#endif