Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve connection #344

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -94,6 +95,11 @@ bool configStoredInEEPROM()
return configLengthEEPROM > 0;
}

bool getBoardReady()
{
return boardReady;
}

// ************************************************************
// configBuffer handling
// ************************************************************
Expand Down Expand Up @@ -605,6 +611,7 @@ void OnGetConfig()
}
}
cmdMessenger.sendCmdEnd();
boardReady = true;
}

void OnGetInfo()
Expand Down
2 changes: 2 additions & 0 deletions src/MF_Analog/Analog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/MF_Button/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/MF_DigInMux/DigInMux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/MF_Encoder/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/MF_InputShifter/InputShifter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ void OnGetInfo(void);
void OnGenNewSerial(void);
void OnSetName(void);
void restoreName(void);
bool getBoardReady();

// config.h
Loading