From 31b7c4a34fd22c1cedc9c2ed9f98235eb6f3b49c Mon Sep 17 00:00:00 2001 From: Dmitry422 Date: Fri, 28 Mar 2025 13:48:32 +0700 Subject: [PATCH] Night shift done. --- .../services/notification/notification_app.c | 12 +++++++----- applications/services/rgb_backlight/rgb_backlight.c | 6 +++--- .../services/rgb_backlight/rgb_backlight_settings.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/applications/services/notification/notification_app.c b/applications/services/notification/notification_app.c index 3eca2fd2d..b5a95b4a3 100644 --- a/applications/services/notification/notification_app.c +++ b/applications/services/notification/notification_app.c @@ -53,7 +53,8 @@ void night_shift_timer_callback(void* context) { NotificationApp* app = context; DateTime current_date_time; - // save current night_shift; + // IN DEVELOPMENT + // // save current night_shift; // float old_night_shift = app->current_night_shift; // take system time and convert to minutes @@ -70,6 +71,7 @@ void night_shift_timer_callback(void* context) { app->rgb_srv->current_night_shift = app->settings.night_shift; } + // IN DEVELOPMENT // // if night shift was changed then update stock and rgb backlight to new value // if(old_night_shift != app->current_night_shift) { // notification_message(app, &sequence_display_backlight_on); @@ -177,7 +179,7 @@ static void notification_reset_notification_layer( // --- NIGHT SHIFT --- furi_hal_light_set( LightBacklight, - app->settings.display_brightness * 0xFF * app->current_night_shift); + app->settings.display_brightness * 0xFF * app->current_night_shift * 1.0f); // --- NIGHT SHIFT END--- } furi_timer_start(app->display_timer, notification_settings_display_off_delay_ticks(app)); @@ -268,7 +270,7 @@ static void notification_process_notification_message( notification_apply_notification_led_layer( &app->display, notification_message->data.led.value * display_brightness_setting * - app->current_night_shift); + app->current_night_shift * 1.0f); reset_mask |= reset_display_mask; //start rgb_mod_rainbow_timer when display backlight is ON and all corresponding settings is ON too @@ -294,7 +296,7 @@ static void notification_process_notification_message( notification_apply_internal_led_layer( &app->display, notification_message->data.led.value * display_brightness_setting * - app->current_night_shift); + app->current_night_shift * 1.0f); } break; case NotificationMessageTypeLedDisplayBacklightEnforceAuto: @@ -304,7 +306,7 @@ static void notification_process_notification_message( notification_apply_internal_led_layer( &app->display, notification_message->data.led.value * display_brightness_setting * - app->current_night_shift); + app->current_night_shift * 1.0f); } // --- NIGHT SHIFT END --- } else { diff --git a/applications/services/rgb_backlight/rgb_backlight.c b/applications/services/rgb_backlight/rgb_backlight.c index 8862ac154..916357b89 100644 --- a/applications/services/rgb_backlight/rgb_backlight.c +++ b/applications/services/rgb_backlight/rgb_backlight.c @@ -137,9 +137,9 @@ void rgb_backlight_update(float brightness) { if(app->settings->rgb_backlight_installed) { for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { - uint8_t r = current_led[i].red * brightness; - uint8_t g = current_led[i].green * brightness; - uint8_t b = current_led[i].blue * brightness; + uint8_t r = current_led[i].red * brightness * 1.0f; + uint8_t g = current_led[i].green * brightness * 1.0f; + uint8_t b = current_led[i].blue * brightness * 1.0f; SK6805_set_led_color(i, r, g, b); } SK6805_update(); diff --git a/applications/services/rgb_backlight/rgb_backlight_settings.c b/applications/services/rgb_backlight/rgb_backlight_settings.c index 17f6bb271..baa573a77 100644 --- a/applications/services/rgb_backlight/rgb_backlight_settings.c +++ b/applications/services/rgb_backlight/rgb_backlight_settings.c @@ -30,7 +30,7 @@ typedef struct { uint16_t rainbow_step; uint8_t rainbow_saturation; uint8_t rainbow_wide; - + } RGBBacklightSettingsPrevious; void rgb_backlight_settings_load(RGBBacklightSettings* settings) {