Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Fixing random RGB flickering (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL authored Feb 24, 2024
2 parents c4cab4c + b52c394 commit 662d9d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/drivers/SK6805.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void SK6805_set_led_color(uint8_t led_index, uint8_t r, uint8_t g, uint8_t b) {
void SK6805_update() {
FURI_LOG_T(TAG, "update");
SK6805_init();
furi_kernel_lock();
FURI_CRITICAL_ENTER();
uint32_t end;
// Sequential sending LEDs
for(uint8_t lednumber = 0; lednumber < SK6805_LED_COUNT; lednumber++) {
Expand Down Expand Up @@ -100,5 +100,5 @@ void SK6805_update() {
}
}
}
furi_kernel_unlock();
FURI_CRITICAL_EXIT();
}
7 changes: 6 additions & 1 deletion lib/drivers/rgb_backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ void rgb_backlight_reconfigure(bool enabled) {
rgb_state.rainbow_hsv.s = rgb_settings.rainbow_saturation;
rgb_backlight_update(rgb_state.last_brightness, false);

if(rgb_state.enabled && rgb_settings.rainbow_mode == RGBBacklightRainbowModeOff)
SK6805_update();

furi_check(furi_mutex_release(rgb_state.mutex) == FuriStatusOk);
}

Expand Down Expand Up @@ -286,8 +289,10 @@ void rgb_backlight_update(uint8_t brightness, bool tick) {
return;
}

bool brightness_changed = brightness != rgb_state.last_brightness;
rgb_state.last_brightness = brightness;
SK6805_update();
if(rgb_settings.rainbow_mode != RGBBacklightRainbowModeOff || brightness_changed)
SK6805_update();

furi_check(furi_mutex_release(rgb_state.mutex) == FuriStatusOk);
}

0 comments on commit 662d9d7

Please sign in to comment.