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

Fix broken Lighting Layers when RGBLIGHT_MAX_LAYERS > 16 (layer>=16 not operable) #11406

Merged
merged 4 commits into from
Jan 2, 2021
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
8 changes: 4 additions & 4 deletions quantum/rgblight.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_set

#ifdef RGBLIGHT_LAYERS
void rgblight_set_layer_state(uint8_t layer, bool enabled) {
rgblight_layer_mask_t mask = 1 << layer;
rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer;
if (enabled) {
rgblight_status.enabled_layer_mask |= mask;
} else {
Expand All @@ -649,7 +649,7 @@ void rgblight_set_layer_state(uint8_t layer, bool enabled) {
}

bool rgblight_get_layer_state(uint8_t layer) {
rgblight_layer_mask_t mask = 1 << layer;
rgblight_layer_mask_t mask = (rgblight_layer_mask_t)1 << layer;
return (rgblight_status.enabled_layer_mask & mask) != 0;
}

Expand Down Expand Up @@ -689,15 +689,15 @@ static uint16_t _blink_timer;

void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) {
rgblight_set_layer_state(layer, true);
_blinked_layer_mask |= 1 << layer;
_blinked_layer_mask |= (rgblight_layer_mask_t)1 << layer;
_blink_timer = timer_read();
_blink_duration = duration_ms;
}

void rgblight_unblink_layers(void) {
if (_blinked_layer_mask != 0 && timer_elapsed(_blink_timer) > _blink_duration) {
for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
if ((_blinked_layer_mask & 1 << layer) != 0) {
if ((_blinked_layer_mask & (rgblight_layer_mask_t)1 << layer) != 0) {
rgblight_set_layer_state(layer, false);
}
}
Expand Down