Closed
Description
Hardware:
Board: Lolin32
Core Installation version: d5fdd71
IDE name: IDF component
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 8.1
Description:
delay() doesn't work for periods smaller than one tick(10ms) (it is also rounded down if not divisible by 1 tick).
It is a small change but I can create a pull request if it is the proper way to do things also, just tell me.
Sketch: (leave the backquotes for code formatting)
Current code is:
void delay(uint32_t ms)
{
vTaskDelay(ms / portTICK_PERIOD_MS);
}
// My suggestion is:
void delay(uint32_t ms)
{
uint32_t delay_end = millis() + ms;
vTaskDelay(ms / portTICK_PERIOD_MS);
while (delay_end > millis()) {
NOP();
}
}