From 09e51c23992ca329d3f6ae7d159d4338e7dc6c98 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Mon, 8 Mar 2021 19:40:06 +0100 Subject: [PATCH] Sunrise/sunset info added to settings.. Sunrise/sunset calculated every minute (debug). --- wled00/data/settings_time.htm | 1 + wled00/html_settings.h | 37 ++++++++++++++++++----------------- wled00/ntp.cpp | 2 +- wled00/wled.h | 2 +- wled00/xml.cpp | 4 ++++ 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/wled00/data/settings_time.htm b/wled00/data/settings_time.htm index d0bf0910..15540ae4 100644 --- a/wled00/data/settings_time.htm +++ b/wled00/data/settings_time.htm @@ -120,6 +120,7 @@ Current local time is unknown.
Latitude (N): Longitude (E): +

Clock

Clock Overlay: Longitude (E):

Clock

Clock Overlay: -
First LED: Last LED:
12h LED:
Show 5min marks:
-
Seconds (as trail):
Cronixie Display:
-Cronixie Backlight:
Countdown Mode: -
Countdown Goal:
Year: 20 Month: Day:
Hour: Minute: Second:
-

Macro presets

Macros have moved!
+type="number" min="-180" max="180" step="0.01">
+

Clock

Clock Overlay:
First LED: + Last LED:
12h LED: +
Show 5min marks: +
Seconds (as trail):
Cronixie Display:
Cronixie Backlight:
Countdown Mode:
+Countdown Goal:
Year: 20 Month: Day: +
Hour: Minute: Second:

Macro presets

Macros have moved! +
Presets now also can be used as macros to save both JSON and HTTP API commands.
Just enter the preset id below!
Use 0 for the default action instead of a preset
Alexa On/Off Preset: diff --git a/wled00/ntp.cpp b/wled00/ntp.cpp index c615d59c..3787c7a4 100644 --- a/wled00/ntp.cpp +++ b/wled00/ntp.cpp @@ -264,7 +264,7 @@ void checkTimers() lastTimerMinute = minute(localTime); // 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; tim_0.tm_year = year(localTime)-1900; tim_0.tm_mon = month(localTime)-1; diff --git a/wled00/wled.h b/wled00/wled.h index a963ef70..a2200e40 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // 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 //#define WLED_USE_MY_CONFIG diff --git a/wled00/xml.cpp b/wled00/xml.cpp index bba955a0..47d20639 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -451,6 +451,10 @@ void getSettingsJS(byte subPage, char* dest) sappends('s',SET_F("LT"),tm); getTimeString(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('v',SET_F("O1"),overlayMin); sappend('v',SET_F("O2"),overlayMax);