Sunrise/sunset info added to settings..

Sunrise/sunset calculated every minute (debug).
This commit is contained in:
Blaz Kristan 2021-03-08 19:40:06 +01:00
parent 0892eb271d
commit 09e51c2399
5 changed files with 26 additions and 20 deletions

View File

@ -120,6 +120,7 @@
Current local time is <span class="times">unknown</span>.<br> Current local time is <span class="times">unknown</span>.<br>
Latitude (N): <input name="LT" type="number" min="-66.6" max="66.6" step="0.01"> Latitude (N): <input name="LT" type="number" min="-66.6" max="66.6" step="0.01">
Longitude (E): <input name="LN" type="number" min="-180" max="180" step="0.01"> Longitude (E): <input name="LN" type="number" min="-180" max="180" step="0.01">
<div id="sun" class="times"></div>
<h3>Clock</h3> <h3>Clock</h3>
Clock Overlay: Clock Overlay:
<select name="OL" onchange="Cs()"> <select name="OL" onchange="Cs()">

View File

@ -318,24 +318,25 @@ US-MST/MDT</option><option value="7">US-AZ</option><option value="8">US-PST/PDT
max="65500" required> seconds (max. 18 hours)<br>Current local time is <span max="65500" required> seconds (max. 18 hours)<br>Current local time is <span
class="times">unknown</span>.<br>Latitude (N): <input name="LT" type="number" class="times">unknown</span>.<br>Latitude (N): <input name="LT" type="number"
min="-66.6" max="66.6" step="0.01"> Longitude (E): <input name="LN" min="-66.6" max="66.6" step="0.01"> Longitude (E): <input name="LN"
type="number" min="-180" max="180" step="0.01"><h3>Clock</h3>Clock Overlay: type="number" min="-180" max="180" step="0.01"><div id="sun" class="times">
<select name="OL" onchange="Cs()"><option value="0" id="cn" selected="selected"> </div><h3>Clock</h3>Clock Overlay: <select name="OL" onchange="Cs()"><option
None</option><option value="1" id="ca">Analog Clock</option><option value="2"> value="0" id="cn" selected="selected">None</option><option value="1" id="ca">
Single Digit Clock</option><option value="3" id="cc">Cronixie Clock</option> Analog Clock</option><option value="2">Single Digit Clock</option><option
</select><br><div id="coc">First LED: <input name="O1" type="number" min="0" value="3" id="cc">Cronixie Clock</option></select><br><div id="coc">First LED:
max="255" required> Last LED: <input name="O2" type="number" min="0" max="255" <input name="O1" type="number" min="0" max="255" required> Last LED: <input
required><br><div id="cac">12h LED: <input name="OM" type="number" min="0" name="O2" type="number" min="0" max="255" required><br><div id="cac">12h LED:
max="255" required><br>Show 5min marks: <input type="checkbox" name="O5"><br> <input name="OM" type="number" min="0" max="255" required><br>Show 5min marks:
</div>Seconds (as trail): <input type="checkbox" name="OS"><br></div><div <input type="checkbox" name="O5"><br></div>Seconds (as trail): <input
id="ccc">Cronixie Display: <input name="CX" maxlength="6"><br> type="checkbox" name="OS"><br></div><div id="ccc">Cronixie Display: <input
Cronixie Backlight: <input type="checkbox" name="CB"><br></div>Countdown Mode: name="CX" maxlength="6"><br>Cronixie Backlight: <input type="checkbox"
<input type="checkbox" name="CE"><br>Countdown Goal:<br>Year: 20 <input name="CB"><br></div>Countdown Mode: <input type="checkbox" name="CE"><br>
name="CY" type="number" min="0" max="99" required> Month: <input name="CI" Countdown Goal:<br>Year: 20 <input name="CY" type="number" min="0" max="99"
type="number" min="1" max="12" required> Day: <input name="CD" type="number" required> Month: <input name="CI" type="number" min="1" max="12" required> Day:
min="1" max="31" required><br>Hour: <input name="CH" type="number" min="0" <input name="CD" type="number" min="1" max="31" required><br>Hour: <input
max="23" required> Minute: <input name="CM" type="number" min="0" max="59" name="CH" type="number" min="0" max="23" required> Minute: <input name="CM"
required> Second: <input name="CS" type="number" min="0" max="59" required><br> type="number" min="0" max="59" required> Second: <input name="CS" type="number"
<h3>Macro presets</h3><b>Macros have moved!</b><br><i> min="0" max="59" required><br><h3>Macro presets</h3><b>Macros have moved!</b>
<br><i>
Presets now also can be used as macros to save both JSON and HTTP API commands. Presets now also can be used as macros to save both JSON and HTTP API commands.
<br>Just enter the preset id below!</i> <i> <br>Just enter the preset id below!</i> <i>
Use 0 for the default action instead of a preset</i><br>Alexa On/Off Preset: Use 0 for the default action instead of a preset</i><br>Alexa On/Off Preset:

View File

@ -264,7 +264,7 @@ void checkTimers()
lastTimerMinute = minute(localTime); lastTimerMinute = minute(localTime);
// calculate sunrise and sunset at midnight (if longitude and latitude are set) // calculate sunrise and sunset at midnight (if longitude and latitude are set)
if (((int)longitude || (int)latitude) && ((!hour(localTime) && !minute(localTime)) || (!sunrise && !sunset))) { if (((int)longitude || (int)latitude) /*&& ((!hour(localTime) && !minute(localTime)) || (!sunrise && !sunset))*/) {
struct tm tim_0; struct tm tim_0;
tim_0.tm_year = year(localTime)-1900; tim_0.tm_year = year(localTime)-1900;
tim_0.tm_mon = month(localTime)-1; tim_0.tm_mon = month(localTime)-1;

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2103080 #define VERSION 2103081
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG

View File

@ -451,6 +451,10 @@ void getSettingsJS(byte subPage, char* dest)
sappends('s',SET_F("LT"),tm); sappends('s',SET_F("LT"),tm);
getTimeString(tm); getTimeString(tm);
sappends('m',SET_F("(\"times\")[0]"),tm); sappends('m',SET_F("(\"times\")[0]"),tm);
if ((int)longitude || (int)latitude) {
sprintf_P(tm, PSTR("Sunrise: %02d:%02d Sunset: %02d:%02d"), hour(sunrise), minute(sunrise), hour(sunset), minute(sunset));
sappends('m',SET_F("(\"times\")[1]"),tm);
}
sappend('i',SET_F("OL"),overlayCurrent); sappend('i',SET_F("OL"),overlayCurrent);
sappend('v',SET_F("O1"),overlayMin); sappend('v',SET_F("O1"),overlayMin);
sappend('v',SET_F("O2"),overlayMax); sappend('v',SET_F("O2"),overlayMax);