Skip to content

Commit 43b5937

Browse files
committed
atmel-samd: Fix converting watchdog seconds to cycles
It's intended that the actual timeout always be at least the requested timeout. However, due to multiplying by the wrong factor to get from seconds to cycles, a timeout request of e.g., 8.1s (which is less than 8.192s) would give an actual timeout of 8, not 16 as it should.
1 parent c27b3a0 commit 43b5937

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void setup_wdt(watchdog_watchdogtimer_obj_t *self, int setting) {
7070
}
7171

7272
void common_hal_watchdog_set_timeout(watchdog_watchdogtimer_obj_t *self, mp_float_t new_timeout) {
73-
int wdt_cycles = (int)(new_timeout * 1000);
73+
int wdt_cycles = (int)(new_timeout * 1024);
7474
if (wdt_cycles < 8) {
7575
wdt_cycles = 8;
7676
}

0 commit comments

Comments
 (0)