if the original espruino does better than the ESP32 port.
Yes - the official boards use an IRQ-based timer. Just tried this on a Pico and it's exactly 2ms to as near as I can measure on my digital scope (so well within 1%)... And if that's not good enough there's some documentation on how to use the timer peripherals in the device itself.
There was a recent change in ESP8266 courtesy of @MaBe that fixed the issues that has, and it does look like the ESP32 is using IRQs so I'm not sure why there would be the variance.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Yes - the official boards use an IRQ-based timer. Just tried this on a Pico and it's exactly 2ms to as near as I can measure on my digital scope (so well within 1%)... And if that's not good enough there's some documentation on how to use the timer peripherals in the device itself.
There was a recent change in ESP8266 courtesy of @MaBe that fixed the issues that has, and it does look like the ESP32 is using IRQs so I'm not sure why there would be the variance.
I just had a quick look and @JumJum it could be that
gettimeofday
may be using the normal low-speed RTC, which might explain some timekeeping issues: https://github.com/espressif/esp-idf/blob/master/examples/protocols/sntp/README.md#timekeepingWhile the timer is accurate, it's set using the current time as a base - so if the timekeeping is 'grainy' it can screw things up.