Set up scheduled program cycles #24

Merged
W1CDN merged 41 commits from program-cycle into main 2023-09-15 16:51:45 -05:00
Showing only changes of commit f496a10ef2 - Show all commits

View File

@ -555,9 +555,16 @@ void setup() {
inputMessage = request->getParam(PARAM_TIME)->value();
//https://stackoverflow.com/a/22733127/2152245
yourInputTime = atol(inputMessage.c_str());
Serial.print("yourInputTime: ");
Serial.println(yourInputTime);
// update the RTC time
rtc.adjust(DateTime(yourInputTime));
// Might work to fix random errors? If date is far in the future,
// try to update again.
while(rtc.now().year() > 2100){
Serial.println("RTC can't set time. Trying again.");
rtc.adjust(DateTime(yourInputTime));
}
;
DateTime now = rtc.now();
Serial.print("UTC time from browser: ");
@ -575,6 +582,9 @@ void setup() {
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.print("rtc.now().unixtime(): ");
Serial.println(rtc.now().unixtime());
}
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
if (request->hasParam(PARAM_FLOAT)) {