Update CubeGotchi.ino

This commit is contained in:
Tomislav Kopić 2024-06-12 11:00:12 +00:00
parent c59b5c1e45
commit 6a46a2f9b9

View File

@ -68,14 +68,10 @@ static void hal_log(log_level_t level, char *buff, ...) {
static void hal_sleep_until(timestamp_t ts) { static void hal_sleep_until(timestamp_t ts) {
#ifdef ENABLE_REAL_TIME #ifdef ENABLE_REAL_TIME
while (true) {
// Calculate the remaining time until the target timestamp
int32_t remaining = (int32_t) (ts - hal_get_timestamp()); int32_t remaining = (int32_t) (ts - hal_get_timestamp());
// Exit the loop if the target time has been reached or passed if (remaining > 0) {
if (remaining <= 0) { delayMicroseconds(remaining);
break; delayMicroseconds(1000);
}
delayMicroseconds(remaining); // Delay for remaining microseconds
} }
#endif #endif
} }