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

Draft: Add settings and OTA lock state to info #4279

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion wled00/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,8 @@ void serializeInfo(JsonObject root)
os += 0x40;
#endif

root[F("settingsLocked")] = !correctPIN;

//os += 0x20; // indicated now removed Blynk support, may be reused to indicate another build-time option

#ifdef USERMOD_CRONIXIE
Expand All @@ -818,9 +820,10 @@ void serializeInfo(JsonObject root)
#endif
#ifndef WLED_DISABLE_OTA
os += 0x01;
root[F("otaLocked")] = otaLock;
#endif
root[F("opt")] = os;

root[F("brand")] = F(WLED_BRAND);
root[F("product")] = F(WLED_PRODUCT_NAME);
root["mac"] = escapedMac;
Expand Down
1 change: 1 addition & 0 deletions wled00/set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
wifiLock = request->hasArg(F("OW"));
aOtaEnabled = request->hasArg(F("AO"));
//createEditHandler(correctPIN && !otaLock);
interfaceUpdateCallMode = CALL_MODE_WS_SEND;
}
}

Expand Down
1 change: 1 addition & 0 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void WLED::loop()
if (strlen(settingsPIN)>0 && correctPIN && millis() - lastEditTime > PIN_TIMEOUT) {
correctPIN = false;
createEditHandler(false);
interfaceUpdateCallMode = CALL_MODE_WS_SEND; // schedule WS update
}

// reconnect WiFi to clear stale allocations if heap gets too low
Expand Down
4 changes: 2 additions & 2 deletions wled00/wled_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ void initServer()
releaseJSONBufferLock();

if (verboseResponse) {
interfaceUpdateCallMode = CALL_MODE_WS_SEND; // schedule WS update
if (!isConfig) {
lastInterfaceUpdate = millis(); // prevent WS update until cooldown
interfaceUpdateCallMode = CALL_MODE_WS_SEND; // schedule WS update
lastInterfaceUpdate = millis(); // prevent WS update until cooldown
serveJson(request); return; //if JSON contains "v"
} else {
doSerializeConfig = true; //serializeConfig(); //Save new settings to FS
Expand Down