[SSTV] Reworked macro configuration system

This commit is contained in:
jgromes 2023-11-27 21:19:04 +01:00
parent eddde76371
commit 974c027452
2 changed files with 10 additions and 10 deletions

View file

@ -1,5 +1,5 @@
#include "SSTV.h" #include "SSTV.h"
#if !defined(RADIOLIB_EXCLUDE_SSTV) #if !RADIOLIB_EXCLUDE_SSTV
const SSTVMode_t Scottie1 { const SSTVMode_t Scottie1 {
.visCode = RADIOLIB_SSTV_SCOTTIE_1, .visCode = RADIOLIB_SSTV_SCOTTIE_1,
@ -156,19 +156,19 @@ const SSTVMode_t PasokonP7 {
SSTVClient::SSTVClient(PhysicalLayer* phy) { SSTVClient::SSTVClient(PhysicalLayer* phy) {
phyLayer = phy; phyLayer = phy;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
audioClient = nullptr; audioClient = nullptr;
#endif #endif
} }
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
SSTVClient::SSTVClient(AFSKClient* audio) { SSTVClient::SSTVClient(AFSKClient* audio) {
phyLayer = audio->phyLayer; phyLayer = audio->phyLayer;
audioClient = audio; audioClient = audio;
} }
#endif #endif
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
int16_t SSTVClient::begin(const SSTVMode_t& mode) { int16_t SSTVClient::begin(const SSTVMode_t& mode) {
if(audioClient == nullptr) { if(audioClient == nullptr) {
// this initialization method can only be used in AFSK mode // this initialization method can only be used in AFSK mode
@ -292,7 +292,7 @@ uint16_t SSTVClient::getPictureHeight() const {
void SSTVClient::tone(float freq, uint32_t len) { void SSTVClient::tone(float freq, uint32_t len) {
Module* mod = phyLayer->getMod(); Module* mod = phyLayer->getMod();
uint32_t start = mod->hal->micros(); uint32_t start = mod->hal->micros();
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
if(audioClient != nullptr) { if(audioClient != nullptr) {
audioClient->tone(freq, false); audioClient->tone(freq, false);
} else { } else {

View file

@ -3,7 +3,7 @@
#include "../../TypeDef.h" #include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_SSTV) #if !RADIOLIB_EXCLUDE_SSTV
#include "../PhysicalLayer/PhysicalLayer.h" #include "../PhysicalLayer/PhysicalLayer.h"
#include "../AFSK/AFSK.h" #include "../AFSK/AFSK.h"
@ -122,7 +122,7 @@ class SSTVClient {
*/ */
explicit SSTVClient(PhysicalLayer* phy); explicit SSTVClient(PhysicalLayer* phy);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Constructor for AFSK mode. \brief Constructor for AFSK mode.
\param audio Pointer to the AFSK instance providing audio. \param audio Pointer to the AFSK instance providing audio.
@ -141,7 +141,7 @@ class SSTVClient {
*/ */
int16_t begin(float base, const SSTVMode_t& mode); int16_t begin(float base, const SSTVMode_t& mode);
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
/*! /*!
\brief Initialization method for AFSK. \brief Initialization method for AFSK.
\param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2, \param mode SSTV mode to be used. Currently supported modes are Scottie1, Scottie2,
@ -182,11 +182,11 @@ class SSTVClient {
*/ */
uint16_t getPictureHeight() const; uint16_t getPictureHeight() const;
#if !defined(RADIOLIB_GODMODE) #if !RADIOLIB_GODMODE
private: private:
#endif #endif
PhysicalLayer* phyLayer; PhysicalLayer* phyLayer;
#if !defined(RADIOLIB_EXCLUDE_AFSK) #if !RADIOLIB_EXCLUDE_AFSK
AFSKClient* audioClient; AFSKClient* audioClient;
#endif #endif