Skip to content

Commit ccb832c

Browse files
committed
fix delay/yield on avr, if function called by yield takes more a millisecond the delay fails
1 parent c96d9bc commit ccb832c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/arduino/wiring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ unsigned long micros() {
105105

106106
void delay(unsigned long ms)
107107
{
108-
uint16_t start = (uint16_t)micros();
108+
uint32_t start = micros();
109109

110110
while (ms > 0) {
111111
yield();
112-
if (((uint16_t)micros() - start) >= 1000) {
112+
while ( ms > 0 && (micros() - start) >= 1000) {
113113
ms--;
114114
start += 1000;
115115
}

0 commit comments

Comments
 (0)