From 48fbf1f7aa3bdd21cf0765242274a105a02b5b7b Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Tue, 2 May 2023 14:32:40 +0200 Subject: [PATCH] Click on on/off on a power button will automatically apply the transition time now. --- firmware/data/index_template_bottom.html | 4 ++-- firmware/data/org/index_template_bottom.html | 4 ++-- firmware/firmware.ino | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/firmware/data/index_template_bottom.html b/firmware/data/index_template_bottom.html index 5890eff..07b4858 100644 --- a/firmware/data/index_template_bottom.html +++ b/firmware/data/index_template_bottom.html @@ -202,7 +202,7 @@ event.preventDefault(); var id = this.id.replace('on', '').replace('_off', ''); // Erstelle eine neue Anfrage an die entsprechende URL var xhr = new XMLHttpRequest(); -xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=false', true); +xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=false&transition=' + document.getElementById('transition').value, true); // Sende die Anfrage im Hintergrund xhr.send(); updateLightState(); @@ -219,7 +219,7 @@ event.preventDefault(); var id = this.id.replace('on', '').replace('_on', ''); // Erstelle eine neue Anfrage an die entsprechende URL var xhr = new XMLHttpRequest(); -xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=true', true); +xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=true&transition=' + document.getElementById('transition').value, true); // Sende die Anfrage im Hintergrund xhr.send(); updateLightState(); diff --git a/firmware/data/org/index_template_bottom.html b/firmware/data/org/index_template_bottom.html index 125b2f3..9542afe 100644 --- a/firmware/data/org/index_template_bottom.html +++ b/firmware/data/org/index_template_bottom.html @@ -202,7 +202,7 @@ var id = this.id.replace('on', '').replace('_off', ''); // Erstelle eine neue Anfrage an die entsprechende URL var xhr = new XMLHttpRequest(); - xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=false', true); + xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=false&transition=' + document.getElementById('transition').value, true); // Sende die Anfrage im Hintergrund xhr.send(); updateLightState(); @@ -219,7 +219,7 @@ var id = this.id.replace('on', '').replace('_on', ''); // Erstelle eine neue Anfrage an die entsprechende URL var xhr = new XMLHttpRequest(); - xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=true', true); + xhr.open('GET', 'http://{{IP_ADDRESS}}/?on' + id + '=true&transition=' + document.getElementById('transition').value, true); // Sende die Anfrage im Hintergrund xhr.send(); updateLightState(); diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 3c546af..ba85e9e 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -480,6 +480,7 @@ void init_webserver() { // set the default transition time for all lights process_lightdata(i, default_transitiontime); + Serial.println("transition for light " + (String)i + " set to " + (String)default_transitiontime); } } }