diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-06-09 12:41:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-09 12:41:18 -0700 |
| commit | 9b8d6489869a5283efb35cd6632fa198f8b5493b (patch) | |
| tree | 38d1a260cfa1b1ae43ac204ed8ac188a6effccff | |
| parent | 0ba541d49878f8fa62aca7822e8c7d333dd5c2f0 (diff) | |
| parent | ec7a3feeba913b615c785fb03015f9edbedbaa95 (diff) | |
Merge pull request #3020 from DavePutz/issue2958
Issue #2958 Correct calculation of subticks being returned from port_get_raw_ticks() for esp32s2
| -rw-r--r-- | ports/esp32s2/supervisor/port.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index 4c42f11af..2437b4f34 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -118,7 +118,8 @@ uint32_t port_get_saved_word(void) { uint64_t port_get_raw_ticks(uint8_t* subticks) { struct timeval tv_now; gettimeofday(&tv_now, NULL); - uint64_t all_subticks = (uint64_t)tv_now.tv_usec / 32768; + // convert usec back to ticks + uint64_t all_subticks = (uint64_t)(tv_now.tv_usec * 2) / 71; if (subticks != NULL) { *subticks = all_subticks % 32; } |
