Skip to content

Commit 93f2368

Browse files
committed
time: fix millis wrap around in delay()
1 parent 67eab5c commit 93f2368

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cores/arduino/time.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
__attribute__((weak)) void delay(uint32_t ms)
88
{
9-
auto const start = millis();
10-
auto const stop = start + ms;
11-
while(millis() < stop) yield();
9+
uint32_t const start = millis();
10+
while(millis() - start < ms) yield();
1211
}
1312

1413
void delayMicroseconds(unsigned int us) {

0 commit comments

Comments
 (0)