We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 97502e9 commit 3b6466bCopy full SHA for 3b6466b
cores/arduino/delay.c
@@ -63,17 +63,22 @@ unsigned long micros( void )
63
64
void delay( unsigned long ms )
65
{
66
- if ( ms == 0 )
+ if (ms == 0)
67
68
- return ;
+ return;
69
}
70
71
- uint32_t start = _ulTickCount ;
+ uint32_t start = micros();
72
73
- do
+ while (ms > 0)
74
75
- yield() ;
76
- } while ( _ulTickCount - start < ms ) ;
+ yield();
+ while (ms > 0 && (micros() - start) >= 1000)
77
+ {
78
+ ms--;
79
+ start += 1000;
80
+ }
81
82
83
84
#include "Reset.h" // for tickReset()
0 commit comments