summaryrefslogtreecommitdiffstats
path: root/keyboards/keychron
diff options
context:
space:
mode:
authorlokher <lokher@gmail.com>2023-04-20 15:51:23 +0800
committerlokher <lokher@gmail.com>2023-04-20 15:51:23 +0800
commit103badc87cb50db1ff3851c84331e86ba78fb681 (patch)
treec23b8bdf74e132474da0c3d9d2bc4410abdad587 /keyboards/keychron
parent45550030192ff3305bc8ef5263d86b865bb2a815 (diff)
fix led issue
Diffstat (limited to 'keyboards/keychron')
-rwxr-xr-xkeyboards/keychron/bluetooth/indicator.c30
-rwxr-xr-xkeyboards/keychron/bluetooth/indicator.h1
2 files changed, 19 insertions, 12 deletions
diff --git a/keyboards/keychron/bluetooth/indicator.c b/keyboards/keychron/bluetooth/indicator.c
index 7a6a54510c..4348460700 100755
--- a/keyboards/keychron/bluetooth/indicator.c
+++ b/keyboards/keychron/bluetooth/indicator.c
@@ -476,7 +476,7 @@ void indicator_task(void) {
}
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
-static void os_state_indicate(void) {
+__attribute__((weak)) void os_state_indicate(void) {
# if defined(NUM_LOCK_INDEX)
if (host_keyboard_led_state().num_lock) {
SET_LED_ON(NUM_LOCK_INDEX);
@@ -559,18 +559,24 @@ bool LED_INDICATORS_KB(void) {
}
bool led_update_kb(led_t led_state) {
- if (!LED_DRIVER_IS_ENABLED()) {
-# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
- LED_DRIVER.exit_shutdown();
-# endif
- SET_ALL_LED_OFF();
- os_state_indicate();
- LED_DRIVER.flush();
-# if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
- if (LED_DRIVER_ALLOW_SHUTDOWN()) LED_DRIVER.shutdown();
-# endif
+ bool res = led_update_user(led_state);
+ if (res) {
+ led_update_ports(led_state);
+
+ if (!LED_DRIVER_IS_ENABLED()) {
+ # if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
+ LED_DRIVER.exit_shutdown();
+ # endif
+ SET_ALL_LED_OFF();
+ os_state_indicate();
+ LED_DRIVER.flush();
+ # if defined(LED_MATRIX_DRIVER_SHUTDOWN_ENABLE) || defined(RGB_MATRIX_DRIVER_SHUTDOWN_ENABLE)
+ if (LED_DRIVER_ALLOW_SHUTDOWN()) LED_DRIVER.shutdown();
+ # endif
+ }
}
- return true;
+
+ return res;
}
void LED_NONE_INDICATORS_KB(void) {
diff --git a/keyboards/keychron/bluetooth/indicator.h b/keyboards/keychron/bluetooth/indicator.h
index d1345d2235..a2eb3f019c 100755
--- a/keyboards/keychron/bluetooth/indicator.h
+++ b/keyboards/keychron/bluetooth/indicator.h
@@ -106,6 +106,7 @@ void indicator_stop(void);
void indicator_eeconfig_reload(void);
bool indicator_is_enabled(void);
bool indicator_is_running(void);
+void os_state_indicate(void);
#ifdef BAT_LOW_LED_PIN
void indicator_battery_low_enable(bool enable);