summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2023-10-17 00:34:20 -0700
committerGitHub <noreply@github.com>2023-10-17 14:34:20 +0700
commit47c470ea25b7c0c07182090dd3c5e54b34c2d701 (patch)
tree9cd4cbde6dfd684c61f26ae7eeb0064c0126ea1c
parented23f8a3691b6bc30d0f443b8f6a659c895b5b5e (diff)
feat: make voyager indicator leds use binary for layer indication (#375)
-rw-r--r--keyboards/voyager/voyager.c51
1 files changed, 5 insertions, 46 deletions
diff --git a/keyboards/voyager/voyager.c b/keyboards/voyager/voyager.c
index b951987bc1..9fb6bb0c1f 100644
--- a/keyboards/voyager/voyager.c
+++ b/keyboards/voyager/voyager.c
@@ -115,55 +115,14 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
#ifdef ORYX_ENABLE
if (rawhid_state.rgb_control) return state;
#endif
- bool LED_1 = false;
- bool LED_2 = false;
- bool LED_3 = false;
-# if !defined(CAPS_LOCK_STATUS)
- bool LED_4 = false;
-# endif
-
uint8_t layer = get_highest_layer(state);
- switch (layer) {
- case 1:
- LED_1 = true;
- break;
- case 2:
- LED_2 = true;
- break;
- case 3:
- LED_3 = true;
- break;
- case 4:
-# if !defined(CAPS_LOCK_STATUS)
- LED_4 = true;
-# endif
- break;
- case 5:
- LED_1 = true;
- LED_2 = true;
- break;
- case 6:
- LED_1 = true;
- LED_2 = true;
- LED_3 = true;
- break;
- case 7:
- LED_1 = true;
- LED_2 = true;
- LED_3 = true;
-# if !defined(CAPS_LOCK_STATUS)
- LED_4 = true;
-# endif
- break;
- default:
- break;
- }
- STATUS_LED_1(LED_1);
- STATUS_LED_2(LED_2);
- STATUS_LED_3(LED_3);
+ STATUS_LED_1(layer & (1<<0));
+ STATUS_LED_2(layer & (1<<1));
+ STATUS_LED_3(layer & (1<<2));
+
# if !defined(CAPS_LOCK_STATUS)
- STATUS_LED_4(LED_4);
+ STATUS_LED_4(layer & (1<<3));
# endif
return state;
}