Sunrise/sunset debugging for PIR sensor.

This commit is contained in:
Blaž Kristan 2021-05-11 09:36:30 +02:00
parent e0c0f29fc6
commit 05b86a71fd
2 changed files with 15 additions and 10 deletions

View File

@ -108,16 +108,21 @@ private:
uint8_t hr = hour(localTime); uint8_t hr = hour(localTime);
uint8_t mi = minute(localTime); uint8_t mi = minute(localTime);
if (sunrise==0 || sunset==0) return false; DEBUG_PRINTF("--Time: %02d:%02d\n", (int)hr, (int)mi);
if (sunrise && sunset) {
if (hour(sunrise)>hr && hour(sunset)<hr) { DEBUG_PRINTLN(F("--Sunrise & sunset detected."));
isDayTime = true; if (hour(sunrise)>hr && hour(sunset)<hr) {
} else {
if (hour(sunrise)==hr && minute(sunrise)<mi) {
isDayTime = true;
}
if (hour(sunset)==hr && minute(sunset)>mi) {
isDayTime = true; isDayTime = true;
DEBUG_PRINTLN(F("--It is daytime."));
} else {
if (hour(sunrise)==hr && minute(sunrise)<mi) {
isDayTime = true;
DEBUG_PRINTLN(F("--It is daytime."));
}
if (hour(sunset)==hr && minute(sunset)>mi) {
isDayTime = true;
DEBUG_PRINTLN(F("--It is daytime."));
}
} }
} }
return isDayTime; return isDayTime;

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2105101 #define VERSION 2105111
//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