Skip to content
Open
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
15 changes: 12 additions & 3 deletions nightstand_clock/clock_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const NotificationSequence led_reset = {

void set_backlight_brightness(float brightness) {
notif->settings.display_brightness = brightness;
notification_message(notif, &sequence_display_backlight_on);
furi_hal_light_set(LightBacklight, brightness * 0xFF);
}

void handle_up() {
Expand Down Expand Up @@ -315,7 +315,6 @@ int32_t clock_app(void* p) {
float tmpBrightness = notif->settings.display_brightness;
brightness = tmpBrightness * 100; // Keep current brightness by default

notification_message(notif, &sequence_display_backlight_enforce_on);
notification_message(notif, &led_off);

// Set system callbacks
Expand Down Expand Up @@ -395,8 +394,18 @@ int32_t clock_app(void* p) {
free(plugin_state);

set_backlight_brightness(tmpBrightness);
notification_message(notif, &sequence_display_backlight_enforce_auto);
notification_message(notif, &led_reset);

// Force RGB backlight update to restore original color settings
// by temporarily changing brightness and restoring it
if(momentum_settings.rgb_backlight) {
uint8_t current_brightness = tmpBrightness * 0xFF;
// Temporarily set brightness to 0 to force update
furi_hal_light_set(LightBacklight, 0);
furi_delay_ms(10); // Small delay to ensure the change takes effect
// Restore original brightness
furi_hal_light_set(LightBacklight, current_brightness);
}

return 0;
}