diff --git a/src/input/ScanAndSelect.cpp b/src/input/ScanAndSelect.cpp index eeecca01c3..d693d768cb 100644 --- a/src/input/ScanAndSelect.cpp +++ b/src/input/ScanAndSelect.cpp @@ -1,3 +1,9 @@ +#include "configuration.h" + +// Normally these input methods are protected by guarding in setupModules +// In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen class +#if HAS_SCREEN + #include "ScanAndSelect.h" #include "modules/CannedMessageModule.h" @@ -193,4 +199,6 @@ void ScanAndSelectInput::handleChangeInterrupt() scanAndSelectInput->enableThread(); } -ScanAndSelectInput *scanAndSelectInput = nullptr; // Instantiated in setupModules method. Deleted if unused, or init() fails \ No newline at end of file +ScanAndSelectInput *scanAndSelectInput = nullptr; // Instantiated in setupModules method. Deleted if unused, or init() fails + +#endif \ No newline at end of file diff --git a/src/input/ScanAndSelect.h b/src/input/ScanAndSelect.h index 14fe744fb2..0b3e2716e4 100644 --- a/src/input/ScanAndSelect.h +++ b/src/input/ScanAndSelect.h @@ -16,6 +16,10 @@ #include "concurrency/OSThread.h" #include "main.h" +// Normally these input methods are protected by guarding in setupModules +// In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen class +#if HAS_SCREEN + class ScanAndSelectInput : public Observable, public concurrency::OSThread { public: @@ -41,4 +45,6 @@ class ScanAndSelectInput : public Observable, public concurr uint32_t alertingSinceMs = 0; // Used to dismiss the "no canned message" alert several seconds }; -extern ScanAndSelectInput *scanAndSelectInput; // Instantiated in setupModules method. Deleted if unused, or init() fails \ No newline at end of file +extern ScanAndSelectInput *scanAndSelectInput; // Instantiated in setupModules method. Deleted if unused, or init() fails + +#endif \ No newline at end of file diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index dd4cd6c5fc..3df8fc170c 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -145,11 +145,15 @@ void setupModules() delete upDownInterruptImpl1; upDownInterruptImpl1 = nullptr; } + +#if HAS_SCREEN + // In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen class scanAndSelectInput = new ScanAndSelectInput(); if (!scanAndSelectInput->init()) { delete scanAndSelectInput; scanAndSelectInput = nullptr; } +#endif cardKbI2cImpl = new CardKbI2cImpl(); cardKbI2cImpl->init();