diff --git a/VortexEngine/src/VortexEngine.cpp b/VortexEngine/src/VortexEngine.cpp index 20efd93d24..c53843a8ed 100644 --- a/VortexEngine/src/VortexEngine.cpp +++ b/VortexEngine/src/VortexEngine.cpp @@ -3,6 +3,8 @@ #include "Wireless/IRReceiver.h" #include "Wireless/IRSender.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" @@ -39,18 +41,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; @@ -93,9 +107,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 a98528d975..19f83e1b50 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,14 +9,10 @@ #include "../Modes/Mode.h" #include "../Log/Log.h" -#include "IRConfig.h" - #ifdef VORTEX_EMBEDDED #include #endif -#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 dc31c4aa9d..5ec181188c 100644 --- a/VortexEngine/src/Wireless/IRSender.cpp +++ b/VortexEngine/src/Wireless/IRSender.cpp @@ -1,11 +1,12 @@ #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 @@ -14,8 +15,6 @@ #include #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 f4a7815213..d7a52c763a 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" @@ -12,8 +15,6 @@ #include #endif -#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 93297fa37c..cc14ca254e 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