Skip to content

Commit b1231c3

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

File tree

1 file changed

+2
-2
lines changed
  • hardware/arduino/avr/cores/arduino

1 file changed

+2
-2
lines changed

hardware/arduino/avr/cores/arduino/wiring.c

+2-2
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)