diff options
author | lokher <lokher@gmail.com> | 2022-08-26 09:48:51 +0800 |
---|---|---|
committer | lokher <lokher@gmail.com> | 2022-08-26 09:48:51 +0800 |
commit | 652e6f3db8a5568c81be506401526c54c6dc4358 (patch) | |
tree | 57d5786b700b413e6a652ea06df55c5776c24ccc | |
parent | 6829fbd074c11e731b92be11e7fa857b8ab9baba (diff) |
Fix indicator issue
-rw-r--r-- | keyboards/keychron/bluetooth/indicator.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/keyboards/keychron/bluetooth/indicator.c b/keyboards/keychron/bluetooth/indicator.c index 38e35cceeb..fa9c9fc6e4 100644 --- a/keyboards/keychron/bluetooth/indicator.c +++ b/keyboards/keychron/bluetooth/indicator.c @@ -213,8 +213,9 @@ static void indicator_timer_cb(void *arg) { if ((indicator_config.duration == 0 || indicator_config.elapsed <= indicator_config.duration) && next_period != 0) { indicator_config.elapsed += next_period; - } else + } else { time_up = true; + } } break; default: @@ -224,6 +225,21 @@ static void indicator_timer_cb(void *arg) { break; } +#ifdef HOST_LED_PIN_LIST + if (indicator_config.value) + { + uint8_t idx = (indicator_config.value & 0x0F) - 1; + + if (idx < HOST_DEVICES_COUNT) { + if ((indicator_config.value & 0x80) && !time_up) { + writePin(host_led_pin_list[idx], HOST_LED_PIN_ON_STATE); + } else { + writePin(host_led_pin_list[idx], !HOST_LED_PIN_ON_STATE); + } + } + } +#endif + if (time_up) { /* Set indicator to off on timeup, avoid keeping light up until next update in raindrop effect */ indicator_config.value = indicator_config.value & 0x0F; @@ -236,20 +252,6 @@ static void indicator_timer_cb(void *arg) { indicator_config.value = 0; } -#ifdef HOST_LED_PIN_LIST - if (indicator_config.value) - { - uint8_t idx = (indicator_config.value & 0x0F) - 1; - chDbgAssert(idx < HOST_DEVICES_COUNT, "array out of bounds"); - - if (indicator_config.value & 0x80) { - writePin(host_led_pin_list[idx], HOST_LED_PIN_ON_STATE); - } else { - writePin(host_led_pin_list[idx], !HOST_LED_PIN_ON_STATE); - } - } -#endif - if (indicator_config.value == 0 && !indicator_is_backlit_enabled_eeprom()) { indicator_disable(); } |