diff --git a/src/Config.cpp b/src/Config.cpp index ccc82cf2..03ba4f63 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -79,6 +79,7 @@ uint16_t configLengthEEPROM = 0; boolean configActivated = false; uint16_t pNameBuffer = 0; // pointer for nameBuffer during reading of config const uint16_t configLengthFlash = sizeof(CustomDeviceConfig); +bool boardReady = false; void resetConfig(); void readConfig(); @@ -94,6 +95,11 @@ bool configStoredInEEPROM() return configLengthEEPROM > 0; } +bool getBoardReady() +{ + return boardReady; +} + // ************************************************************ // configBuffer handling // ************************************************************ @@ -605,6 +611,7 @@ void OnGetConfig() } } cmdMessenger.sendCmdEnd(); + boardReady = true; } void OnGetInfo() diff --git a/src/MF_Analog/Analog.cpp b/src/MF_Analog/Analog.cpp index 8920d4c9..f3d96e71 100644 --- a/src/MF_Analog/Analog.cpp +++ b/src/MF_Analog/Analog.cpp @@ -17,6 +17,8 @@ namespace Analog void handlerOnAnalogChange(int value, const char *name) { + if (!getBoardReady()) + return; cmdMessenger.sendCmdStart(kAnalogChange); cmdMessenger.sendCmdArg(name); cmdMessenger.sendCmdArg(value); diff --git a/src/MF_Button/Button.cpp b/src/MF_Button/Button.cpp index 5fa39def..343b56fc 100644 --- a/src/MF_Button/Button.cpp +++ b/src/MF_Button/Button.cpp @@ -16,6 +16,8 @@ namespace Button void handlerButtonOnChange(uint8_t eventId, const char *name) { + if (!getBoardReady()) + return; cmdMessenger.sendCmdStart(kButtonChange); cmdMessenger.sendCmdArg(name); cmdMessenger.sendCmdArg(eventId); diff --git a/src/MF_DigInMux/DigInMux.cpp b/src/MF_DigInMux/DigInMux.cpp index a838ed91..984bab0b 100644 --- a/src/MF_DigInMux/DigInMux.cpp +++ b/src/MF_DigInMux/DigInMux.cpp @@ -18,6 +18,8 @@ namespace DigInMux void handlerOnDigInMux(uint8_t eventId, uint8_t channel, const char *name) { + if (!getBoardReady()) + return; cmdMessenger.sendCmdStart(kDigInMuxChange); cmdMessenger.sendCmdArg(name); cmdMessenger.sendCmdArg(channel); diff --git a/src/MF_Encoder/Encoder.cpp b/src/MF_Encoder/Encoder.cpp index 0d99c23d..49ce2a82 100644 --- a/src/MF_Encoder/Encoder.cpp +++ b/src/MF_Encoder/Encoder.cpp @@ -16,6 +16,8 @@ namespace Encoder void handlerOnEncoder(uint8_t eventId, const char *name) { + if (!getBoardReady()) + return; cmdMessenger.sendCmdStart(kEncoderChange); cmdMessenger.sendCmdArg(name); cmdMessenger.sendCmdArg(eventId); diff --git a/src/MF_InputShifter/InputShifter.cpp b/src/MF_InputShifter/InputShifter.cpp index 50671ac5..20a7b1fe 100644 --- a/src/MF_InputShifter/InputShifter.cpp +++ b/src/MF_InputShifter/InputShifter.cpp @@ -16,6 +16,8 @@ namespace InputShifter void handlerInputShifterOnChange(uint8_t eventId, uint8_t pin, const char *name) { + if (!getBoardReady()) + return; cmdMessenger.sendCmdStart(kInputShifterChange); cmdMessenger.sendCmdArg(name); cmdMessenger.sendCmdArg(pin); diff --git a/src/config.h b/src/config.h index d0de7d82..269e9c10 100644 --- a/src/config.h +++ b/src/config.h @@ -40,5 +40,6 @@ void OnGetInfo(void); void OnGenNewSerial(void); void OnSetName(void); void restoreName(void); +bool getBoardReady(); // config.h \ No newline at end of file