From 93f2368f3b4d1eb6593456985e13c196472870cb Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 11 Dec 2025 09:43:58 +0100 Subject: [PATCH] time: fix millis wrap around in delay() --- cores/arduino/time.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cores/arduino/time.cpp b/cores/arduino/time.cpp index c5269c928..bc01b5e28 100644 --- a/cores/arduino/time.cpp +++ b/cores/arduino/time.cpp @@ -6,9 +6,8 @@ __attribute__((weak)) void delay(uint32_t ms) { - auto const start = millis(); - auto const stop = start + ms; - while(millis() < stop) yield(); + uint32_t const start = millis(); + while(millis() - start < ms) yield(); } void delayMicroseconds(unsigned int us) {