From 161a7e2a78bc84dcece930b475fe421baed301c0 Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Thu, 27 Apr 2023 19:26:06 +0200 Subject: [PATCH] Added logic to send slider changes to the controller. Comments updated. --- firmware/firmware.ino | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 9e2d623..55169d1 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -332,6 +332,7 @@ void init_webserver() { DynamicJsonDocument root(1024); root["on"] = light_state[light]; root["bri"] = bri[light]; + root["bricur"] = (int)current_bri[light]; String output; serializeJson(root, output); server.send(200, "text/plain", output); @@ -446,7 +447,9 @@ void init_webserver() { if (server.hasArg("bri" + (String)light)) { bri[light] = (int)server.arg("bri" + (String)light).toInt(); - Serial.print("Brightness set to "); + Serial.print("Brightness "); + Serial.print(light); + Serial.print(" set to "); Serial.println(bri[light]); } @@ -508,6 +511,7 @@ void init_webserver() { String http_content = ""; http_content += ""; http_content += ""; + http_content += ""; http_content += ""; http_content += ""; //http_content += ""; // Reload the page every 15 seconds automatically @@ -527,11 +531,31 @@ void init_webserver() { http_content += ""; http_content += "
"; + http_content += ""; #ifndef DISABLE_WEB_CONTROL http_content += "
"; // Light control - for (uint8 light_num = 0; light_num < LIGHTS_COUNT; light_num++) { + for (uint8 light_num = 0; light_num < LIGHTS_COUNT; light_num++) + { + // on/off buttons http_content += "

Light " + (String)(light_num + 1) + "

"; http_content += "
"; http_content += ""; @@ -541,9 +565,10 @@ void init_webserver() { http_content += "\" href=\"/?on" + (String)light_num + "=false\">OFF"; http_content += "
"; + // slider for brightness http_content += "
"; http_content += ""; - http_content += ""; + http_content += ""; http_content += "%"; http_content += ""; http_content += "
"; + } - // timer data processing, startup state and scene for all of the lights + // startup state and scene for all of the lights http_content += "
"; http_content += "
"; http_content += "

"; @@ -577,6 +603,7 @@ void init_webserver() { http_content += ""; http_content += ""; + // scene http_content += "
"; http_content += ""; http_content += ""; http_content += "
"; + // timing control button http_content += "
"; - http_content += ""; + http_content += ""; int tc_val = EEPROM.read(EEPROM_TIMING_CONTROL_ENABLED_ADDRESS); http_content += "