From a22ca687771363debd0157311df8b4779b898d10 Mon Sep 17 00:00:00 2001 From: Phil Hollenback Date: Thu, 2 Feb 2023 13:18:51 -0800 Subject: [PATCH] Allow a larger int for the idle timeout Existing code used a uint32_t for the idle timer, but the comparisons were done with timer_read and timer_elapsed so actual comparison was on uint16_t. This meant the idle timer could not be more than 65535 milliseconds, or just over 1 minute. Switched the comparisons to timer_read32 and timer_elapsed32 so that the largest possible timeout is 4,294,967,295ms, or 136 years. While that would be pretty ridiculous, at least this way more reasonable longer timeouts like 15 minutes or an hour will work. --- keyboards/massdrop/alt/keymaps/urbanvanilla/keymap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/massdrop/alt/keymaps/urbanvanilla/keymap.c b/keyboards/massdrop/alt/keymaps/urbanvanilla/keymap.c index e1b6de116e71..c5905d502fb9 100644 --- a/keyboards/massdrop/alt/keymaps/urbanvanilla/keymap.c +++ b/keyboards/massdrop/alt/keymaps/urbanvanilla/keymap.c @@ -49,7 +49,7 @@ uint8_t currentWPM; bool process_record_user(uint16_t keycode, keyrecord_t *record) { static uint32_t key_timer; -idle_timer = timer_read(); +idle_timer = timer_read32(); switch (keycode) { @@ -146,7 +146,7 @@ idle_timer = timer_read(); void matrix_scan_user(void) { //custom idle rbg switch off function - if (timer_elapsed(idle_timer) > IDLE_TIMER_DURATION) { + if (timer_elapsed32(idle_timer) > IDLE_TIMER_DURATION) { idle_timer = 0; timer_clear(); rgbkeyIdle = true;