8000 Merge pull request #3020 from DavePutz/issue2958 · jensechu/circuitpython@9b8d648 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b8d648

Browse files
authored
Merge pull request adafruit#3020 from DavePutz/issue2958
Issue adafruit#2958 Correct calculation of subticks being returned from port_get_raw_ticks() for esp32s2
2 parents 0ba541d + ec7a3fe commit 9b8d648

File tree

1 file changed

+2
-1
lines changed
  • ports/esp32s2/supervisor

1 file changed

+2
-1
lines changed

ports/esp32s2/supervisor/port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ uint32_t port_get_saved_word(void) {
118118
uint64_t port_get_raw_ticks(uint8_t* subticks) {
119119
struct timeval tv_now;
120120
gettimeofday(&tv_now, NULL);
121-
uint64_t all_subticks = (uint64_t)tv_now.tv_usec / 32768;
121+
// convert usec back to ticks
122+
uint64_t all_subticks = (uint64_t)(tv_now.tv_usec * 2) / 71;
122123
if (subticks != NULL) {
123124
*subticks = all_subticks % 32;
124125
}

0 commit comments

Comments
 (0)
0