Skip to content

Commit

Permalink
Clarify bound on number of Bluetooth profile colors (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
khoek authored Apr 15, 2024
1 parent b2ea092 commit b0c91d3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/src/rgb_underglow.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ static void zmk_rgb_underglow_central_send() {
}
}

static const struct led_rgb BT_COLORS[8] = {LED_RGB(0xFFFFFF), LED_RGB(0x0000FF), LED_RGB(0xFF0000),
LED_RGB(0x00FF00), LED_RGB(0x000000)};
#define NUM_BT_COLORS 4

static const struct led_rgb BT_COLORS[NUM_BT_COLORS] = {LED_RGB(0xFFFFFF), LED_RGB(0x0000FF),
LED_RGB(0xFF0000), LED_RGB(0x00FF00)};
#endif

static const struct led_rgb LAYER_COLORS[8] = {
Expand Down Expand Up @@ -295,12 +297,13 @@ static void zmk_rgb_underglow_effect_kinesis() {

// set second led to bluetooth state, blinking quickly if bluetooth not paired,
// and slowly if not connected
int bt_idx = zmk_ble_active_profile_index();
if (zmk_ble_active_profile_is_open()) {
bt_blinking = zmk_kinesis_blink_step(0, 2);
} else if (!zmk_ble_active_profile_is_connected()) {
bt_blinking = zmk_kinesis_blink_step(1, 13);
}
pixels[1] = bt_blinking ? LED_RGB(0x000000) : BT_COLORS[zmk_ble_active_profile_index()];
pixels[1] = (bt_idx < NUM_BT_COLORS && !bt_blinking) ? BT_COLORS[bt_idx] : LED_RGB(0x000000);

// set third led to layer state
pixels[2] = LAYER_COLORS[layer_color_left];
Expand Down

0 comments on commit b0c91d3

Please sign in to comment.