From 92cb60fa468255097b58ef1a77d807bf5d80bcdb Mon Sep 17 00:00:00 2001 From: Unreal-Dan <72595612+Unreal-Dan@users.noreply.github.com> Date: Mon, 1 Jan 2024 02:13:21 -0800 Subject: [PATCH] fixes for IR and VL ifdefs (#200) --- VortexEngine/src/VortexEngine.cpp | 18 ++++++++++++++++++ VortexEngine/src/Wireless/IRReceiver.cpp | 7 +++---- VortexEngine/src/Wireless/IRSender.cpp | 7 +++---- VortexEngine/src/Wireless/VLReceiver.cpp | 5 +++-- VortexEngine/src/Wireless/VLSender.cpp | 5 +++-- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/VortexEngine/src/VortexEngine.cpp b/VortexEngine/src/VortexEngine.cpp index 7467018604..42971ccd7d 100644 --- a/VortexEngine/src/VortexEngine.cpp +++ b/VortexEngine/src/VortexEngine.cpp @@ -4,6 +4,8 @@ #include "Wireless/IRSender.h" #include "Wireless/VLReceiver.h" #include "Wireless/VLSender.h" +#include "Wireless/IRConfig.h" +#include "Wireless/VLConfig.h" #include "Storage/Storage.h" #include "Buttons/Buttons.h" #include "Time/TimeControl.h" @@ -40,22 +42,30 @@ bool VortexEngine::init() DEBUG_LOG("Storage failed to initialize"); return false; } +#if IR_ENABLE_RECEIVER == 1 if (!IRReceiver::init()) { DEBUG_LOG("IRReceiver failed to initialize"); return false; } +#endif +#if IR_ENABLE_SENDER == 1 if (!IRSender::init()) { DEBUG_LOG("IRSender failed to initialize"); return false; } +#endif +#if VL_ENABLE_RECEIVER == 1 if (!VLReceiver::init()) { DEBUG_LOG("VLReceiver failed to initialize"); return false; } +#endif +#if VL_ENABLE_SENDER == 1 if (!VLSender::init()) { DEBUG_LOG("VLSender failed to initialize"); return false; } +#endif if (!Leds::init()) { DEBUG_LOG("Leds failed to initialize"); return false; @@ -98,10 +108,18 @@ void VortexEngine::cleanup() Menus::cleanup(); Buttons::cleanup(); Leds::cleanup(); +#if VL_ENABLE_SENDER == 1 VLSender::cleanup(); +#endif +#if VL_ENABLE_RECEIVER == 1 VLReceiver::cleanup(); +#endif +#if IR_ENABLE_SENDER == 1 IRSender::cleanup(); +#endif +#if IR_ENABLE_RECEIVER == 1 IRReceiver::cleanup(); +#endif Storage::cleanup(); Time::cleanup(); SerialComs::cleanup(); diff --git a/VortexEngine/src/Wireless/IRReceiver.cpp b/VortexEngine/src/Wireless/IRReceiver.cpp index 96370869db..47ec50ef4d 100644 --- a/VortexEngine/src/Wireless/IRReceiver.cpp +++ b/VortexEngine/src/Wireless/IRReceiver.cpp @@ -1,4 +1,7 @@ #include "IRReceiver.h" +#include "IRConfig.h" + +#if IR_ENABLE_RECEIVER == 1 #include "../Serial/ByteStream.h" #include "../Serial/BitStream.h" @@ -6,10 +9,6 @@ #include "../Modes/Mode.h" #include "../Log/Log.h" -#include "IRConfig.h" - -#if IR_ENABLE_RECEIVER == 1 - BitStream IRReceiver::m_irData; IRReceiver::RecvState IRReceiver::m_recvState = WAITING_HEADER_MARK; uint32_t IRReceiver::m_prevTime = 0; diff --git a/VortexEngine/src/Wireless/IRSender.cpp b/VortexEngine/src/Wireless/IRSender.cpp index 187a429285..1d127a1978 100644 --- a/VortexEngine/src/Wireless/IRSender.cpp +++ b/VortexEngine/src/Wireless/IRSender.cpp @@ -1,17 +1,16 @@ #include "IRSender.h" +#include "IRConfig.h" + +#if IR_ENABLE_SENDER == 1 #include "../Time/TimeControl.h" #include "../Modes/Mode.h" #include "../Log/Log.h" -#include "IRConfig.h" - #ifdef VORTEX_LIB #include "VortexLib.h" #endif -#if IR_ENABLE_SENDER == 1 - // the serial buffer for the data ByteStream IRSender::m_serialBuf; // a bit walker for the serial data diff --git a/VortexEngine/src/Wireless/VLReceiver.cpp b/VortexEngine/src/Wireless/VLReceiver.cpp index d418986fb0..8d2f12a9a1 100644 --- a/VortexEngine/src/Wireless/VLReceiver.cpp +++ b/VortexEngine/src/Wireless/VLReceiver.cpp @@ -1,4 +1,7 @@ #include "VLReceiver.h" +#include "IRConfig.h" + +#if VL_ENABLE_RECEIVER == 1 #include "../Serial/ByteStream.h" #include "../Serial/BitStream.h" @@ -7,8 +10,6 @@ #include "../Leds/Leds.h" #include "../Log/Log.h" -#if VL_ENABLE_RECEIVER == 1 - BitStream VLReceiver::m_vlData; VLReceiver::RecvState VLReceiver::m_recvState = WAITING_HEADER_MARK; uint32_t VLReceiver::m_prevTime = 0; diff --git a/VortexEngine/src/Wireless/VLSender.cpp b/VortexEngine/src/Wireless/VLSender.cpp index 2a4e29557f..8b39b9e563 100644 --- a/VortexEngine/src/Wireless/VLSender.cpp +++ b/VortexEngine/src/Wireless/VLSender.cpp @@ -1,4 +1,7 @@ #include "VLSender.h" +#include "IRConfig.h" + +#if VL_ENABLE_SENDER == 1 #include "../Time/TimeControl.h" #include "../Modes/Mode.h" @@ -9,8 +12,6 @@ #include "VortexLib.h" #endif -#if VL_ENABLE_SENDER == 1 - // the serial buffer for the data ByteStream VLSender::m_serialBuf; // a bit walker for the serial data