";
+ http_content.replace("{{LIGHT_NAME}}", (String)light_name);
- http_content += "
";
-
- // timing control button
- http_content += "
";
- http_content += "
";
- http_content += "
";
int tc_val = EEPROM.read(EEPROM_TIMING_CONTROL_ENABLED_ADDRESS);
- http_content += "
ON";
- http_content += "
OFF";
- http_content += "
";
- http_content += "";
- http_content += "
";
+ if (tc_val == TIMING_CONTROL_ENABLED)
+ {
+ http_content.replace("{{TC_LINK_PRIMARY_ON}}", "pure-button-primary");
+ } else {
+ http_content.replace("{{TC_LINK_PRIMARY_ON}}", "");
+ }
+ if (tc_val == TIMING_CONTROL_DISABLED)
+ {
+ http_content.replace("{{TC_LINK_PRIMARY_OFF}}", "pure-button-primary");
+ } else {
+ http_content.replace("{{TC_LINK_PRIMARY_OFF}}", "");
+ }
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
- http_content += "
";
+ http_content.replace("{{TRANSITION_TIME}}", (String)default_transitiontime);
- http_content += "";
-
- http_content += "
";
+ String light_content = "";
// Light control
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 += " ";
- http_content += " ON";
- http_content += " OFF";
- http_content += " ";
+ // Generate lights part of the HTML page
+ String tmp_light_content = getLightControlHTML();
- // slider for brightness
- http_content += "";
- http_content += "";
- http_content += "";
- http_content += " " + (String)(int)(bri[light_num] * 100.0 / 255.0) + "%";
- http_content += " ";
- http_content += "";
- http_content += " %";
- http_content += "";
-
- http_content += " ";
+ // on/off buttons and slider
+ tmp_light_content.replace("{{LIGHT_NUMBER}}", (String)(light_num + 1));
+ tmp_light_content.replace("{{LIGHT_NUMBER_DEC}}", (String)light_num);
+ // add the lights code to the html output string
+ light_content += tmp_light_content;
}
- http_content += "";
- http_content += " | ";
- http_content += "";
- http_content += " |
";
- http_content += "
Config
";
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
+ if (ls_val == LAST_STATE_STARTUP_LIGHT_LAST_STATE)
+ {
+ http_content.replace("{{STARTUP_SELECTED_LS_0}}", "selected=\"selected\"");
+ } else {
+ http_content.replace("{{STARTUP_SELECTED_LS_0}}", "");
+ }
+
+ if (ls_val == LAST_STATE_STARTUP_LIGHT_ON_STATE)
+ {
+ http_content.replace("{{STARTUP_SELECTED_ON_1}}", "selected=\"selected\"");
+ } else {
+ http_content.replace("{{STARTUP_SELECTED_ON_1}}", "");
+ }
+
+ if (ls_val == LAST_STATE_STARTUP_LIGHT_OFF_STATE)
+ {
+ http_content.replace("{{STARTUP_SELECTED_OFF_2}}", "selected=\"selected\"");
+ } else {
+ http_content.replace("{{STARTUP_SELECTED_OFF_2}}", "");
+ }
// scene
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
+ if (sc_val == SCENE_RELEAX)
+ {
+ http_content.replace("{{SCENE_SELECTED_RELAX_0}}", "selected=\"selected\"");
+ } else {
+ http_content.replace("{{SCENE_SELECTED_RELAX_0}}", "");
+ }
+ if (sc_val == SCENE_BRIGHT)
+ {
+ http_content.replace("{{SCENE_SELECTED_BRIGHT_1}}", "selected=\"selected\"");
+ } else {
+ http_content.replace("{{SCENE_SELECTED_BRIGHT_1}}", "");
+ }
+ if (sc_val == SCENE_NIGHTLY)
+ {
+ http_content.replace("{{SCENE_SELECTED_NIGHT_2}}", "selected=\"selected\"");
+ } else {
+ http_content.replace("{{SCENE_SELECTED_NIGHT_2}}", "");
+ }
+
+ // Generate lights part of the HTML page
+ String config_content = getConfigHTML();
// Wifi settings
- http_content += "
";
- http_content += "
Wifi
";
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
+ config_content.replace("{{WIFI_SSIF}}", WiFi.SSID());
// Network settings
uint8_t dip = EEPROM.read(EEPROM_DYNAMIC_IP_ADDRESS);
- http_content += "
";
- http_content += "
Network
";
- http_content += "
";
- http_content += "
";
- http_content += "
ON";
- http_content += "
OFF";
- http_content += "
";
-
- // ip config
- if (dip == 0) {
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
- http_content += "
";
- http_content += "";
- http_content += "";
- http_content += "
";
+ if (dip)
+ {
+ config_content.replace("{{DIP_LINK_ON_PRIMARY}}", "pure-button-primary");
+ config_content.replace("{{DIP_LINK_OFF_PRIMARY}}", "");
+ } else {
+ config_content.replace("{{DIP_LINK_OFF_PRIMARY}}", "pure-button-primary");
+ config_content.replace("{{DIP_LINK_ON_PRIMARY}}", "");
}
- // The save button
- http_content += "
";
- http_content += "";
- http_content += "
";
+ // ip config
+ if (dip == 0)
+ {
+ config_content.replace("{{WIFI_IP}}", WiFi.localIP().toString());
+ config_content.replace("{{WIFI_GW}}", WiFi.gatewayIP().toString());
+ config_content.replace("{{WIFI_NM}}", WiFi.subnetMask().toString());
+ config_content.replace("{{WIFI_DNS}}", WiFi.dnsIP().toString());
+ }
- http_content += "";
-
- http_content += "";
- http_content += "
";
- http_content += "