diff --git a/wled00/data/settings.htm b/wled00/data/settings.htm index 0217df2ed..a2bb4ebcf 100644 --- a/wled00/data/settings.htm +++ b/wled00/data/settings.htm @@ -35,6 +35,8 @@ document.S_form.BTNON.checked = (this.responseXML.getElementsByTagName('btnon')[0].innerHTML)!=0?true:false; document.S_form.TFADE.checked = (this.responseXML.getElementsByTagName('tfade')[0].innerHTML)!=0?true:false; document.S_form.TDLAY.value = this.responseXML.getElementsByTagName('tdlay')[0].innerHTML; + document.S_form.TLDUR.value = this.responseXML.getElementsByTagName('tldur')[0].innerHTML; + document.S_form.TLFDE.checked = (this.responseXML.getElementsByTagName('tlfde')[0].innerHTML)!=0?true:false; document.S_form.NRCVE.checked = (this.responseXML.getElementsByTagName('nrcve')[0].innerHTML)!=0?true:false; document.S_form.NRBRI.value = this.responseXML.getElementsByTagName('nrbri')[0].innerHTML; document.S_form.NSDIR.checked = (this.responseXML.getElementsByTagName('nsdir')[0].innerHTML)!=0?true:false; diff --git a/wled00/wled00.ino b/wled00/wled00.ino index 8ba7701ce..4978fd2ec 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -35,28 +35,30 @@ boolean only_ap = false; uint8_t led_amount = 16; uint8_t buttonPin = 3; //needs pull-up boolean buttonEnabled = true; -String notifier_ips[]{"10.10.1.128","10.10.1.129"}; +String notifier_ips[]{"10.10.1.191","10.10.1.129"}; boolean notifyDirect = true, notifyButton = true, notifyForward = true; boolean receiveNotifications = true; uint8_t bri_n = 100; uint8_t nightlightDelayMins = 60; boolean nightlightFade = true; -double transitionResolution = 0.01; +double transitionResolution = 0.015; //Internal vars byte col_old[]{0, 0, 0}; byte col_t[]{0, 0, 0}; +byte col_it[]{0, 0, 0}; long transitionStartTime; long nightlightStartTime; float tper_last = 0; byte bri = 127; byte bri_old = 0; byte bri_t = 0; +byte bri_it = 0; byte bri_last = 127; boolean transitionActive = false; boolean buttonPressedBefore = false; -int notifier_ips_count = 0; +int notifier_ips_count = 1; String notifier_ips_raw = ""; boolean nightlightActive = false; diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index ff40e5ca7..ad3a42947 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -34,6 +34,8 @@ void saveSettingsToEEPROM() { EEPROM.write(i, appass.charAt(i-160)); } + EEPROM.write(224, nightlightDelayMins); + EEPROM.write(225, nightlightFade); EEPROM.write(228, aphide); EEPROM.write(227, apchannel); EEPROM.write(229, led_amount); diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index 086a6c210..130551126 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -79,6 +79,12 @@ void XML_response_settings() resp = resp + ""; resp = resp + transitionDelay; resp = resp + ""; + resp = resp + ""; + resp = resp + nightlightDelayMins; + resp = resp + ""; + resp = resp + ""; + resp = resp + bool2int(nightlightFade); + resp = resp + ""; resp = resp + ""; resp = resp + bool2int(receiveNotifications); resp = resp + ""; diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index 86f22bac4..231882c7c 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -68,6 +68,9 @@ void wledInit() server.on("/button.png", HTTP_GET, [](){ if(!handleFileRead("/button.png")) server.send(404, "text/plain", "FileNotFound"); }); + server.on("/moon.png", HTTP_GET, [](){ + if(!handleFileRead("/moon.png")) server.send(404, "text/plain", "FileNotFound"); + }); server.on("/favicon.ico", HTTP_GET, [](){ if(!handleFileRead("/favicon.ico")) server.send(404, "text/plain", "FileNotFound"); }); diff --git a/wled00/wled07_notify.ino b/wled00/wled07_notify.ino index d6f2ca517..ca34d42b1 100644 --- a/wled00/wled07_notify.ino +++ b/wled00/wled07_notify.ino @@ -7,7 +7,7 @@ void notify(int callMode) case 3: if (!notifyForward) return; break; default: return; } - String snd = "/ajax_in&N=1&A="; + String snd = "/ajax_inputs&N=1&A="; snd = snd + bri; snd = snd + "&R="; snd = snd + col[0]; @@ -15,17 +15,27 @@ void notify(int callMode) snd = snd + col[1]; snd = snd + "&B="; snd = snd + col[2]; + //snd = snd + " HTTP/1.1"; - HTTPClient hclient; + WiFiClient hclient; + hclient.setTimeout(50); for (int i = 0; i < notifier_ips_count; i++) { - String url = "http://"; - url = url + notifier_ips[i]; - url = url + snd; - - hclient.begin(url); - hclient.GET(); - hclient.end(); + + Serial.println("NCON..."); + if (hclient.connect(notifier_ips[i].c_str(), 80)) + { + Serial.println("CON!"); + Serial.println(snd); + hclient.print(String("GET ") + snd + " HTTP/1.1\r\n" + + "Host: " + notifier_ips[i] + "\r\n" + + "Connection: close\r\n\r\n"); + + } else + { + Serial.println("NO CONNECTION"); + hclient.stop(); + } } } diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 844b26f68..ceae214ab 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -26,10 +26,14 @@ void setLedsStandard() void colorUpdated(int callMode) { //call for notifier -> 0: init 1: direct change 2: button 3: notification - if (col[0] == col_old[0] && col[1] == col_old[1] && col[2] == col_old[2] && bri == bri_old) + if (col[0] == col_it[0] && col[1] == col_it[1] && col[2] == col_it[2] && bri == bri_it) { return; //no change } + col_it[0] = col[0]; + col_it[1] = col[1]; + col_it[2] = col[2]; + bri_it = bri; if (bri > 0) bri_last = bri; notify(callMode); if (fadeTransition || seqTransition)