mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
fix delay/yield on avr, if function called by yield takes more a millisecond the delay fails
This commit is contained in:
parent
d893aa0b65
commit
b1231c39e9
@ -105,11 +105,11 @@ unsigned long micros() {
|
||||
|
||||
void delay(unsigned long ms)
|
||||
{
|
||||
uint16_t start = (uint16_t)micros();
|
||||
uint32_t start = micros();
|
||||
|
||||
while (ms > 0) {
|
||||
yield();
|
||||
if (((uint16_t)micros() - start) >= 1000) {
|
||||
while ( ms > 0 && (micros() - start) >= 1000) {
|
||||
ms--;
|
||||
start += 1000;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user