mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Don't use timer for zero delay
This commit is contained in:
parent
6d9c77ebe1
commit
03f35e44f0
@ -48,10 +48,20 @@ void delay_end(void* arg)
|
||||
|
||||
void delay(unsigned long ms)
|
||||
{
|
||||
os_timer_setfn(&delay_timer, (os_timer_func_t*) &delay_end, 0);
|
||||
os_timer_arm(&delay_timer, ms, ONCE);
|
||||
if (ms)
|
||||
{
|
||||
os_timer_setfn(&delay_timer, (os_timer_func_t*) &delay_end, 0);
|
||||
os_timer_arm(&delay_timer, ms, ONCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
esp_schedule();
|
||||
}
|
||||
esp_yield();
|
||||
os_timer_disarm(&delay_timer);
|
||||
if (ms)
|
||||
{
|
||||
os_timer_disarm(&delay_timer);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long micros()
|
||||
|
Loading…
x
Reference in New Issue
Block a user