diff options
Diffstat (limited to 'keyboards/keychron/bluetooth')
-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(); } |