fix delay/yield on avr, if function called by yield takes more a millisecond the delay fails

This commit is contained in:
vbextreme 2015-12-27 14:49:25 +01:00
parent c96d9bc6ec
commit ccb832c224
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}