Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify bound/configuration of number of Bluetooth profile colors #20

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -290,12 +292,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
Loading