From 5df11bedb0a13e37235e90bd92b04502067b0dd8 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Sat, 24 Feb 2024 14:05:33 +0100 Subject: [PATCH] Implement on checkbox and jsonhandler bugfix --- src/App/AppModFixture.h | 5 ++++- src/Sys/SysModWeb.cpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/App/AppModFixture.h b/src/App/AppModFixture.h index dd98cc38..b1346f6f 100644 --- a/src/App/AppModFixture.h +++ b/src/App/AppModFixture.h @@ -25,6 +25,9 @@ class AppModFixture:public SysModule { case f_UIFun: ui->setLabel(var, "On"); return true; + case f_ChangeFun: + ui->callVarFun("bri", UINT8_MAX, f_ChangeFun); //set FastLed brightness + return true; default: return false; }}); currentVar["stage"] = true; @@ -37,7 +40,7 @@ class AppModFixture:public SysModule { case f_ChangeFun: { uint8_t bri = var["value"]; - uint8_t result = linearToLogarithm(var, bri); + uint8_t result = mdl->getValue("on").as()?linearToLogarithm(var, bri):0; FastLED.setBrightness(result); diff --git a/src/Sys/SysModWeb.cpp b/src/Sys/SysModWeb.cpp index 8f981785..dc167a85 100644 --- a/src/Sys/SysModWeb.cpp +++ b/src/Sys/SysModWeb.cpp @@ -532,12 +532,13 @@ void SysModWeb::jsonHandler(WebRequest *request, JsonVariant json) { USER_PRINT_Async("processJsonUrl response %s\n", resStr); request->send(200, "application/json", resStr); - web->sendResponseObject(); } else // request->send(200, "text/plain", "OK"); request->send(200, "application/json", F("{\"success\":true}")); } + + web->sendResponseObject(); } void SysModWeb::clientsToJson(JsonArray array, bool nameOnly, const char * filter) {