Skip to content

Commit

Permalink
Allow a larger int for the idle timeout
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tels7ar committed Feb 2, 2023
1 parent eeadbd2 commit a22ca68
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions keyboards/massdrop/alt/keymaps/urbanvanilla/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a22ca68

Please sign in to comment.