1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 12:42:30 +04:00

Night shift done.

This commit is contained in:
Dmitry422
2025-03-28 13:48:32 +07:00
parent cd28f7d232
commit 31b7c4a34f
3 changed files with 11 additions and 9 deletions

View File

@@ -53,7 +53,8 @@ void night_shift_timer_callback(void* context) {
NotificationApp* app = context; NotificationApp* app = context;
DateTime current_date_time; DateTime current_date_time;
// save current night_shift; // IN DEVELOPMENT
// // save current night_shift;
// float old_night_shift = app->current_night_shift; // float old_night_shift = app->current_night_shift;
// take system time and convert to minutes // 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; 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 night shift was changed then update stock and rgb backlight to new value
// if(old_night_shift != app->current_night_shift) { // if(old_night_shift != app->current_night_shift) {
// notification_message(app, &sequence_display_backlight_on); // notification_message(app, &sequence_display_backlight_on);
@@ -177,7 +179,7 @@ static void notification_reset_notification_layer(
// --- NIGHT SHIFT --- // --- NIGHT SHIFT ---
furi_hal_light_set( furi_hal_light_set(
LightBacklight, LightBacklight,
app->settings.display_brightness * 0xFF * app->current_night_shift); app->settings.display_brightness * 0xFF * app->current_night_shift * 1.0f);
// --- NIGHT SHIFT END--- // --- NIGHT SHIFT END---
} }
furi_timer_start(app->display_timer, notification_settings_display_off_delay_ticks(app)); 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( notification_apply_notification_led_layer(
&app->display, &app->display,
notification_message->data.led.value * display_brightness_setting * notification_message->data.led.value * display_brightness_setting *
app->current_night_shift); app->current_night_shift * 1.0f);
reset_mask |= reset_display_mask; reset_mask |= reset_display_mask;
//start rgb_mod_rainbow_timer when display backlight is ON and all corresponding settings is ON too //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( notification_apply_internal_led_layer(
&app->display, &app->display,
notification_message->data.led.value * display_brightness_setting * notification_message->data.led.value * display_brightness_setting *
app->current_night_shift); app->current_night_shift * 1.0f);
} }
break; break;
case NotificationMessageTypeLedDisplayBacklightEnforceAuto: case NotificationMessageTypeLedDisplayBacklightEnforceAuto:
@@ -304,7 +306,7 @@ static void notification_process_notification_message(
notification_apply_internal_led_layer( notification_apply_internal_led_layer(
&app->display, &app->display,
notification_message->data.led.value * display_brightness_setting * notification_message->data.led.value * display_brightness_setting *
app->current_night_shift); app->current_night_shift * 1.0f);
} }
// --- NIGHT SHIFT END --- // --- NIGHT SHIFT END ---
} else { } else {

View File

@@ -137,9 +137,9 @@ void rgb_backlight_update(float brightness) {
if(app->settings->rgb_backlight_installed) { if(app->settings->rgb_backlight_installed) {
for(uint8_t i = 0; i < SK6805_get_led_count(); i++) { for(uint8_t i = 0; i < SK6805_get_led_count(); i++) {
uint8_t r = current_led[i].red * brightness; uint8_t r = current_led[i].red * brightness * 1.0f;
uint8_t g = current_led[i].green * brightness; uint8_t g = current_led[i].green * brightness * 1.0f;
uint8_t b = current_led[i].blue * brightness; uint8_t b = current_led[i].blue * brightness * 1.0f;
SK6805_set_led_color(i, r, g, b); SK6805_set_led_color(i, r, g, b);
} }
SK6805_update(); SK6805_update();