Skip to content

Commit

Permalink
Implement on checkbox and jsonhandler bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ewowi committed Feb 24, 2024
1 parent 539e5ea commit 5df11be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/App/AppModFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<bool>()?linearToLogarithm(var, bri):0;

FastLED.setBrightness(result);

Expand Down
3 changes: 2 additions & 1 deletion src/Sys/SysModWeb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5df11be

Please sign in to comment.