diff --git a/firmware/firmware.ino b/firmware/firmware.ino index be1d4ce..ee17ea3 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -593,7 +593,10 @@ void init_webserver() http_content += "
"; 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 += "
"; } @@ -859,6 +863,30 @@ void init_webserver() "}" "setInterval(updateLightState, 10000);" "updateLightState();" + + // show pwm values in webinterface + "function updatePWMValues() {" + "for (let i = 0; i < " + (String)LIGHTS_COUNT + "; i++) {" + "const lightID = i + 1;" + "const pwmElement = document.getElementById(`light${i}_pwm`);" + "const pwmElementTxt = document.getElementById(`light${i}_pwm_txt`);" + "if (pwmElement) {" + "const url = `http://192.168.0.26/state?light=${lightID}`;" + "fetch(url)" + ".then(response => response.json())" + ".then(data => {" + "const pwmValue = data.curpwm - 640;" + //"console.log('curpwm[' + i + '] = ' + data.curpwm);" + "pwmElement.innerText = pwmValue.toString();" + "pwmElement.value = pwmValue;" + "pwmElementTxt.innerText = pwmValue.toString();" + "})" + ".catch(error => console.error(error));" + "}" + "}" + "}" + "updatePWMValues();" + "setInterval(updatePWMValues, 5000);" ""; #endif // DISABLE_WEB_CONTROL diff --git a/firmware/timing_control.ino b/firmware/timing_control.ino index 7b598da..3049d8a 100644 --- a/firmware/timing_control.ino +++ b/firmware/timing_control.ino @@ -251,9 +251,9 @@ void tc_update_main() if (target_data_block > 0) { // hours as seconds from now on to the next enabled block - t_time = ((uint16_t)tc_data[target_data_block].hh * 60 * 60) - ((uint16_t)timeClient.getHours() * 60 * 60); + t_time = ((uint16_t)tc_data[target_data_block].hh * 60 * 60) - ((uint16_t)hour() * 60 * 60); // add the left over seconds to the next enabled block - t_time += ((uint16_t)tc_data[target_data_block].mm * 60) - ((uint16_t)timeClient.getMinutes() * 60); + t_time += ((uint16_t)tc_data[target_data_block].mm * 60) - ((uint16_t)minute() * 60); } transitiontime[0] = t_time;