Skip to content

Commit

Permalink
[settings] Save working state. Fixes !67
Browse files Browse the repository at this point in the history
  • Loading branch information
CODeRUS committed Jan 10, 2022
1 parent bd64e45 commit 38dda82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ void Settings::processConfig(const String &message)
const bool working = doc[F("data")];
Serial.printf_P(PSTR("working: %s\n"), working ? PSTR("true") : PSTR("false"));
mySettings->generalSettings.working = working;
saveLater();
} else if (event == F("ACTIVE_EFFECT")) {
// const int index = doc[F("data")];
// effectsManager->activateEffect(static_cast<uint8_t>(index));
Expand Down Expand Up @@ -488,6 +489,10 @@ bool Settings::readSettings()
generalSettings.activeEffect = root[F("activeEffect")];
}

if (root.containsKey(F("working"))) {
generalSettings.working = root[F("working")];
}

copyFile(settingsFileNameSave, settingsFileName);

return true;
Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ void setup() {
button->setTickMode(false);
button->setStepTimeout(20);

myMatrix->matrixTest();
if (mySettings->generalSettings.working) {
myMatrix->matrixTest();
}

button->tick();
if (button->state()) {
Expand Down

0 comments on commit 38dda82

Please sign in to comment.