[FL-3408, FL-3429, FL-3430] Backlight notification fix (#2878)

* Notifications: display brightness override fix
* FuriHalVersionColor update
* float comparison fix

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov 2023-08-01 10:56:11 +03:00 committed by GitHub
parent ff2e1acfdb
commit a2a4fa8cda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View File

@ -5,7 +5,7 @@
#include <input/input.h>
#include <gui/gui_i.h>
#include <u8g2_glue.h>
#include <lib/toolbox/float_tools.h>
#include "notification.h"
#include "notification_messages.h"
#include "notification_app.h"
@ -104,7 +104,10 @@ static void notification_reset_notification_led_layer(NotificationLedLayer* laye
furi_hal_light_set(layer->light, layer->value[LayerInternal]);
}
static void notification_reset_notification_layer(NotificationApp* app, uint8_t reset_mask) {
static void notification_reset_notification_layer(
NotificationApp* app,
uint8_t reset_mask,
float display_brightness_set) {
if(reset_mask & reset_blink_mask) {
furi_hal_light_blink_stop();
}
@ -124,6 +127,9 @@ static void notification_reset_notification_layer(NotificationApp* app, uint8_t
notification_sound_off();
}
if(reset_mask & reset_display_mask) {
if(!float_is_equal(display_brightness_set, app->settings.display_brightness)) {
furi_hal_light_set(LightBacklight, app->settings.display_brightness * 0xFF);
}
furi_timer_start(app->display_timer, notification_settings_display_off_delay_ticks(app));
}
}
@ -212,13 +218,14 @@ static void notification_process_notification_message(
notification_apply_notification_led_layer(
&app->display,
notification_message->data.led.value * display_brightness_setting);
reset_mask |= reset_display_mask;
} else {
reset_mask &= ~reset_display_mask;
notification_reset_notification_led_layer(&app->display);
if(furi_timer_is_running(app->display_timer)) {
furi_timer_stop(app->display_timer);
}
}
reset_mask |= reset_display_mask;
break;
case NotificationMessageTypeLedDisplayBacklightEnforceOn:
furi_assert(app->display_led_lock < UINT8_MAX);
@ -370,7 +377,7 @@ static void notification_process_notification_message(
}
if(reset_notifications) {
notification_reset_notification_layer(app, reset_mask);
notification_reset_notification_layer(app, reset_mask, display_brightness_setting);
}
}

View File

@ -33,6 +33,7 @@ typedef enum {
FuriHalVersionColorUnknown = 0x00,
FuriHalVersionColorBlack = 0x01,
FuriHalVersionColorWhite = 0x02,
FuriHalVersionColorTransparent = 0x03,
} FuriHalVersionColor;
/** Device Regions */

View File

@ -17,6 +17,7 @@ OTP_COLORS = {
"unknown": 0x00,
"black": 0x01,
"white": 0x02,
"transparent": 0x03,
}
OTP_REGIONS = {