Dunno but I have posted it several times and added minor tweaks as I will highlight below.
@mpo881 the library hack is just a couple of characters and documented at TimeInput Widget delivers ALL days selected when no day is selected - #7 by Darwini
The hack makes no days selected actually mean " I have selected no days as it’s the quickest way of doing scheduling without changing or resetting the times as I might want the same times in the future".
dayadjustment
variable is required because Blynk start the week on a different day to the popular Time Library.
As per the library hack I just disable days with the Widget rather than using the reset time facility. Reset time facility means OFF.
I always thought that computers work with 0 and 1’s with 0 meaning OFF and 1 meaning ON but it turns out I was wrong. For Blynk computers off is -1 as documented from about post #66 at RF 433 Mhz on virtual pin doesn't want to send (with scheduling) - #66 by Costas
In the version of code I posted in that thread we were using unsigned int
for variables associated with time and wrongly assuming no time or off would be zero. No time, as created with the reset facility, is actually -1 and therefore crashes the ESP with an unsigned int
.
So you need to change:
unsigned int nowseconds = ((hour() * 3600) + (minute() * 60) + second());
unsigned int startseconds = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
unsigned int stopseconds = (t.getStopHour() * 3600) + (t.getStopMinute() * 60);
To:
int nowseconds = ((hour() * 3600) + (minute() * 60) + second());
int startseconds = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
int stopseconds = (t.getStopHour() * 3600) + (t.getStopMinute() * 60);