Compare commits

..

No commits in common. "e0310f8c408270125f51157ee25d961de4f3b12a" and "75e5541e5e46a8b3ae9f5832110a04221c4ffcca" have entirely different histories.

2 changed files with 52 additions and 63 deletions

View file

@ -628,70 +628,13 @@ void init_webserver()
http_content += "<fieldset>"; http_content += "<fieldset>";
http_content += "<h3>" + (String)light_name + "</h3>"; http_content += "<h3>" + (String)light_name + "</h3>";
http_content += "<div class=\"pure-form pure-form-aligned\">";
http_content += "<div class=\"pure-controls\">"; http_content += "<div class=\"pure-controls\">";
http_content += "<span class=\"pure-form-message\"><a href=\"/?alert=1\">alert</a> &nbsp; <a href=\"/?reset=1\">reset</a> &nbsp; <a href=\"/?resettc\">reset timing control data</a> &nbsp; <a href=\"/update\">update</a></span>"; http_content += "<span class=\"pure-form-message\"><a href=\"/?alert=1\">alert</a> &nbsp; <a href=\"/?reset=1\">reset</a> &nbsp; <a href=\"/?resettc\">reset timing control data</a> &nbsp; <a href=\"/update\">update</a></span>";
http_content += "<label for=\"cb\" class=\"pure-checkbox\">"; http_content += "<label for=\"cb\" class=\"pure-checkbox\">";
http_content += "</label>"; http_content += "</label>";
http_content += "</div>"; http_content += "</div>";
// timing control button http_content += "<form class=\"pure-form pure-form-aligned\" action=\"/\" method=\"post\">";
http_content += "<br>";
http_content += "<div class=\"pure-control-group\">";
http_content += "<label for=\"tc_on\"><strong>Timing control</strong></label>";
int tc_val = EEPROM.read(EEPROM_TIMING_CONTROL_ENABLED_ADDRESS);
http_content += "<a id=\"tc_on\" class=\"pure-button";
if (tc_val == TIMING_CONTROL_ENABLED) http_content += " pure-button-primary";
http_content += "\" href=\"#\">ON</a>";
http_content += "<a id=\"tc_off\" class=\"pure-button";
if (tc_val == TIMING_CONTROL_DISABLED) http_content += " pure-button-primary";
http_content += "\" href=\"#\">OFF</a>";
http_content += "</div>";
http_content += "<script>"
// Suche nach allen tc Links auf der Seite mit IDs tc_on
"var links = document.querySelectorAll('[id^=\"tc_on\"]');"
// Füge einen Klick-Listener zu jedem Link hinzu
"links.forEach(function(link) {"
"link.addEventListener('click', function(event) {"
// Verhindere, dass der Link die Seite neu lädt
"event.preventDefault();"
// Erstelle eine neue Anfrage an die entsprechende URL
"var xhr = new XMLHttpRequest();"
"xhr.open('GET', 'http://192.168.0.26/?tc=true', true);"
// Sende die Anfrage im Hintergrund
"xhr.send();"
"console.log('tc=true call');"
"document.getElementById('tc_on').classList.add('pure-button-primary');"
"document.getElementById('tc_off').classList.remove('pure-button-primary');"
"});"
"});"
// Suche nach allen tc Links auf der Seite mit IDs tc_off
"var links = document.querySelectorAll('[id^=\"tc_off\"]');"
// Füge einen Klick-Listener zu jedem Link hinzu
"links.forEach(function(link) {"
"link.addEventListener('click', function(event) {"
// Verhindere, dass der Link die Seite neu lädt
"event.preventDefault();"
// Erstelle eine neue Anfrage an die entsprechende URL
"var xhr = new XMLHttpRequest();"
"xhr.open('GET', 'http://192.168.0.26/?tc=false', true);"
// Sende die Anfrage im Hintergrund
"xhr.send();"
"console.log('tc=false call');"
"document.getElementById('tc_off').classList.add('pure-button-primary');"
"document.getElementById('tc_on').classList.remove('pure-button-primary');"
"});"
"});"
"</script>";
http_content += "<br>";
http_content += "<div class=\"pure-control-group\">";
http_content += "<label for=\"transition\">Transition time (s)</label>";
http_content += "<input id=\"transition\" name=\"transition\" type=\"text\" placeholder=\"10\" value=\"" + (String)default_transitiontime + "\">";
http_content += "</div>";
http_content += "<br>";
http_content += "<script>" http_content += "<script>"
"let timeoutId;" // slider value change submit to server "let timeoutId;" // slider value change submit to server
"function sendSliderValue(x) {" "function sendSliderValue(x) {"
@ -779,9 +722,38 @@ void init_webserver()
"updateLightState();" "updateLightState();"
"});" "});"
"});" "});"
"</script>";
http_content += "<form class=\"pure-form pure-form-aligned\" action=\"/\" method=\"post\">"; // Suche nach allen tc Links auf der Seite mit IDs tc_on
"var links = document.querySelectorAll('[id^=\"tc_on\"]');"
// Füge einen Klick-Listener zu jedem Link hinzu
"links.forEach(function(link) {"
"link.addEventListener('click', function(event) {"
// Verhindere, dass der Link die Seite neu lädt
"event.preventDefault();"
// Erstelle eine neue Anfrage an die entsprechende URL
"var xhr = new XMLHttpRequest();"
"xhr.open('GET', 'http://192.168.0.26/?tc=true', true);"
// Sende die Anfrage im Hintergrund
"xhr.send();"
"updateLightState();"
"});"
"});"
// Suche nach allen tc Links auf der Seite mit IDs tc_off
"var links = document.querySelectorAll('[id^=\"tc_off\"]');"
// Füge einen Klick-Listener zu jedem Link hinzu
"links.forEach(function(link) {"
"link.addEventListener('click', function(event) {"
// Verhindere, dass der Link die Seite neu lädt
"event.preventDefault();"
// Erstelle eine neue Anfrage an die entsprechende URL
"var xhr = new XMLHttpRequest();"
"xhr.open('GET', 'http://192.168.0.26/?tc=false', true);"
// Sende die Anfrage im Hintergrund
"xhr.send();"
"updateLightState();"
"});"
"});"
"</script>";
// startup state and scene for all of the lights // startup state and scene for all of the lights
http_content += "</td><td>"; http_content += "</td><td>";
@ -821,6 +793,24 @@ void init_webserver()
http_content += "</select>"; http_content += "</select>";
http_content += "</div>"; http_content += "</div>";
// timing control button
http_content += "<div class=\"pure-control-group\">";
http_content += "<label for=\"tc\"><strong>Timing control</strong></label>";
int tc_val = EEPROM.read(EEPROM_TIMING_CONTROL_ENABLED_ADDRESS);
http_content += "<a id=\"tc_on\" class=\"pure-button";
if (tc_val == TIMING_CONTROL_ENABLED) http_content += " pure-button-primary";
http_content += "\" href=\"#\">ON</a>";
http_content += "<a id=\"tc_off\" class=\"pure-button";
if (tc_val == TIMING_CONTROL_DISABLED) http_content += " pure-button-primary";
http_content += "\" href=\"#\">OFF</a>";
http_content += "</div>";
http_content += "<br>";
http_content += "<div class=\"pure-control-group\">";
http_content += "<label for=\"transition\">Transition time (s)</label>";
http_content += "<input id=\"transition\" name=\"transition\" type=\"text\" placeholder=\"10\" value=\"" + (String)default_transitiontime + "\">";
http_content += "</div>";
// Wifi settings // Wifi settings
http_content += "<br>"; http_content += "<br>";
http_content += "<h3>Wifi</h3>"; http_content += "<h3>Wifi</h3>";
@ -1060,9 +1050,8 @@ void init_webserver()
#endif // DISABLE_WEB_CONTROL #endif // DISABLE_WEB_CONTROL
http_content += "</form>";
http_content += "</div>";
http_content += "</fieldset>"; http_content += "</fieldset>";
http_content += "</form>";
http_content += "</body>"; http_content += "</body>";
http_content += "</html>"; http_content += "</html>";

View file

@ -43,7 +43,7 @@ uint8_t example_timer_data_block[] = {
// hour min ch1 ch2 ch3 ch3 // hour min ch1 ch2 ch3 ch3
8, 0, 0, 0, 0, 0, // 0: off 8, 0, 0, 0, 0, 0, // 0: off
8, 30, 25, 0, 0, 0, // 1: 10% ch1 blues 8, 30, 25, 0, 0, 0, // 1: 10% ch1 blues
11, 0, 25, 0, 25, 0, // 2: 10% all blues 9, 0, 25, 0, 25, 0, // 2: 10% all blues
13, 0, 205, 205, 205, 205, // 3: 80% all 13, 0, 205, 205, 205, 205, // 3: 80% all
18, 0, 205, 205, 205, 205, // 4: 80% all for 5 hours 18, 0, 205, 205, 205, 205, // 4: 80% all for 5 hours
19, 0, 50, 50, 50, 50, // 5: 20% all 19, 0, 50, 50, 50, 50, // 5: 20% all