Fixed MQTT and WS Routing - w/o SSL
This commit is contained in:
@@ -267,9 +267,13 @@ void Timekeeper::checkAndSyncPhysicalClock() {
|
||||
// Calculate time difference (your exact logic!)
|
||||
int16_t timeDifference = (realHour * 60 + realMinute) - (physicalHour * 60 + physicalMinute);
|
||||
|
||||
LOG_VERBOSE("⏰ CHECK: Real time %02d:%02d vs Physical %02d:%02d - DIFF: %d mins",
|
||||
realHour, realMinute, physicalHour, physicalMinute, timeDifference);
|
||||
|
||||
// Handle 12-hour rollover (if negative, add 12 hours)
|
||||
if (timeDifference < 0) {
|
||||
timeDifference += 12 * 60; // Add 12 hours to handle rollover
|
||||
LOG_VERBOSE("⏰ DIFF: Adjusted for rollover, new difference %d minutes", timeDifference);
|
||||
}
|
||||
|
||||
// If there's a difference, advance the clock by one minute (your runMotor equivalent)
|
||||
@@ -310,7 +314,7 @@ void Timekeeper::updatePhysicalClockTime() {
|
||||
currentMinute = 0;
|
||||
currentHour++;
|
||||
if (currentHour > 12) { // 12-hour clock (your code used 24, but clock face is 12)
|
||||
currentHour = 0;
|
||||
currentHour = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user