/** Handle web requests to "/" path. */ void iotWebConfHandleRoot() { // -- Let IotWebConf test and handle captive portal requests. if (iotWebConf.handleCaptivePortal()) { // -- Captive portal request were already served. return; } //char sTemp[12]; String s = ""; s += ""; //s += CUSTOMHTML_BODY_INNER; s += "RGB LED Clock"; s += "RGB LED Clock"; s += "

"; s += ""; s += ""; s += "
Current Time:"; s += printLocalTime(); s += "
Current Timezone:"; s += (getenv("TZ") ? : "(none)"); s += "
"; s += ""; s += ""; s += ""; if (singleSecond) { s += ""; } if (allDotsOn) { s += ""; } s += "
NTP Server:"; s += currentNTP; s += "
Current Brightness value: "; s += String(strip.GetBrightness()); s += "
Max Brightness value: "; s += maxBrightnessParam.value(); s += "
Show Seconds: "; s += (singleSecondParam.isChecked() ? "Yes" : "No"); s += "
All Dots On: "; s += (allDotsOnParam.isChecked() ? "Yes" : "No"); s += "
Following Hour: "; s += (followingHourParam.isChecked() ? "Yes" : "No"); s += "
"; s += "
High noon:
Hour color:
Minute color:
Seconds color:
Backlight:
Hour Marking:
"; s += "

"; s += "Go to configure page to change values."; s += "\n"; server.send(200, "text/html; charset=UTF-8", s); } void iotWebConfConfigSaved() { setTimeZone(); MAX_BRIGHTNESS = maxBrightnessParam.value(); singleSecond = singleSecondParam.isChecked() ? true : false; //Serial.println(singleSecondParam.isChecked() ? "true" : "false"); allDotsOn = allDotsOnParam.isChecked() ? true : false; //Serial.println(allDotsOnParam.isChecked() ? "true" : "false"); #if NUM_LEDS == 60 followingHour = followingHourParam.isChecked() ? true : false; if (!followingHour) { hourOffset = 0 ; } #endif //Serial.println(followingHourParam.isChecked() ? "true" : "false"); transformHtmltoStrip(&highnoonColor, (char*)&highnoonColorParam.value()); transformHtmltoStrip(&hourColor, (char*)&hourColorParam.value()); transformHtmltoStrip(&minuteColor, (char*)&minuteColorParam.value()); transformHtmltoStrip(&secondsColor, (char*)&secondsColorParam.value()); transformHtmltoStrip(&backlightColor, (char*)&backlightColorParam.value()); transformHtmltoStrip(&hourMarkingColor, (char*)&hourMarkingColorParam.value()); Serial.println("Configuration was updated."); } void iotWebConf_Setup() { timeGroup.addItem(&timezoneParam); //timeGroup.addItem(&ntpServerParam); ledGroup.addItem(&maxBrightnessParam); ledGroup.addItem(&singleSecondParam); ledGroup.addItem(&allDotsOnParam); #if NUM_LEDS == 60 ledGroup.addItem(&followingHourParam); #endif ledGroup.addItem(&hourColorParam); ledGroup.addItem(&minuteColorParam); ledGroup.addItem(&secondsColorParam); ledGroup.addItem(&highnoonColorParam); ledGroup.addItem(&backlightColorParam); ledGroup.addItem(&hourMarkingColorParam); iotWebConf.addParameterGroup(&timeGroup); iotWebConf.addParameterGroup(&ledGroup); iotWebConf.setConfigSavedCallback(&iotWebConfConfigSaved); //iotWebConf.setWifiConnectionTimeoutMs(60000); iotWebConf.setWifiConnectionCallback(&ntpReachableCheckCallback); //iotWebConf.setFormValidator(&iotWebConfFormValidator); iotWebConf.getApTimeoutParameter()->visible = true; iotWebConf.setupUpdateServer( [](const char* updatePath) { httpUpdater.setup(&server, updatePath); }, [](const char* userName, char* password) { httpUpdater.updateCredentials(userName, password); }); iotWebConf.setHtmlFormatProvider(&customHtmlFormatProvider); // -- Initializing the configuration. iotWebConf.init(); // -- Set up required URL handlers on the web server. server.on("/", iotWebConfHandleRoot); server.on("/config", [] { iotWebConf.handleConfig(); }); server.onNotFound([]() { iotWebConf.handleNotFound(); }); Serial.println("Ready."); Serial.flush(); } void iotWebConfLoopCallback() { iotWebConf.doLoop(); }