Notification: backlight always on lock. Gpio: backlight always on lock in uart brige app. (#1007)

This commit is contained in:
あく 2022-02-24 03:17:40 +03:00 committed by GitHub
parent 3c77ae2eb8
commit 92734f1bb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 3 deletions

View file

@ -33,6 +33,7 @@ void gpio_scene_usb_uart_on_enter(void* context) {
gpio_usb_uart_set_callback(app->gpio_usb_uart, gpio_scene_usb_uart_callback, app);
scene_manager_set_scene_state(app->scene_manager, GpioAppViewUsbUart, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewUsbUart);
notification_message(app->notifications, &sequence_display_lock);
}
bool gpio_scene_usb_uart_on_event(void* context, SceneManagerEvent event) {
@ -62,4 +63,5 @@ void gpio_scene_usb_uart_on_exit(void* context) {
usb_uart_disable(app->usb_uart_bridge);
free(scene_usb_uart);
}
notification_message(app->notifications, &sequence_display_unlock);
}

View file

@ -40,14 +40,22 @@ typedef union {
typedef enum {
NotificationMessageTypeVibro,
NotificationMessageTypeSoundOn,
NotificationMessageTypeSoundOff,
NotificationMessageTypeLedRed,
NotificationMessageTypeLedGreen,
NotificationMessageTypeLedBlue,
NotificationMessageTypeDelay,
NotificationMessageTypeLedDisplay,
NotificationMessageTypeLedDisplayLock,
NotificationMessageTypeLedDisplayUnlock,
NotificationMessageTypeDoNotReset,
NotificationMessageTypeForceSpeakerVolumeSetting,
NotificationMessageTypeForceVibroSetting,
NotificationMessageTypeForceDisplayBrightnessSetting,

View file

@ -163,6 +163,7 @@ void notification_process_notification_message(
notification_message = (*message->sequence)[notification_message_index];
bool led_active = false;
uint8_t display_led_lock = 0;
uint8_t led_values[NOTIFICATION_LED_COUNT] = {0x00, 0x00, 0x00};
bool reset_notifications = true;
float speaker_volume_setting = app->settings.speaker_volume;
@ -189,6 +190,24 @@ void notification_process_notification_message(
}
reset_mask |= reset_display_mask;
break;
case NotificationMessageTypeLedDisplayLock:
furi_assert(display_led_lock < UINT8_MAX);
display_led_lock++;
if(display_led_lock == 1) {
notification_apply_internal_led_layer(
&app->display,
notification_message->data.led.value * display_brightness_setting);
}
break;
case NotificationMessageTypeLedDisplayUnlock:
furi_assert(display_led_lock > 0);
display_led_lock--;
if(display_led_lock == 0) {
notification_apply_internal_led_layer(
&app->display,
notification_message->data.led.value * display_brightness_setting);
}
break;
case NotificationMessageTypeLedRed:
// store and send on delay or after seq
led_active = true;

View file

@ -15,6 +15,16 @@ const NotificationMessage message_display_off = {
.data.led.value = 0x00,
};
const NotificationMessage message_display_lock = {
.type = NotificationMessageTypeLedDisplayLock,
.data.led.value = 0xFF,
};
const NotificationMessage message_display_unlock = {
.type = NotificationMessageTypeLedDisplayLock,
.data.led.value = 0x00,
};
// Led ON
const NotificationMessage message_red_255 = {
.type = NotificationMessageTypeLedRed,
@ -188,6 +198,16 @@ const NotificationSequence sequence_display_off = {
NULL,
};
const NotificationSequence sequence_display_lock = {
&message_display_lock,
NULL,
};
const NotificationSequence sequence_display_unlock = {
&message_display_unlock,
NULL,
};
// Charging
const NotificationSequence sequence_charging = {
&message_red_255,

View file

@ -9,8 +9,15 @@ extern "C" {
/*********************************** Messages **********************************/
// Display
/** Display: backlight wakeup */
extern const NotificationMessage message_display_on;
/** Display: backlight force off */
extern const NotificationMessage message_display_off;
/** Display: backlight always on lock */
extern const NotificationMessage message_display_lock;
/** Display: backlight always on unlock */
extern const NotificationMessage message_display_unlock;
// Led ON
extern const NotificationMessage message_red_255;
@ -63,8 +70,14 @@ extern const NotificationSequence sequence_reset_vibro;
extern const NotificationSequence sequence_set_vibro_on;
// Display
/** Display: backlight wakeup */
extern const NotificationSequence sequence_display_on;
/** Display: backlight force off */
extern const NotificationSequence sequence_display_off;
/** Display: backlight always on lock */
extern const NotificationSequence sequence_display_lock;
/** Display: backlight always on unlock */
extern const NotificationSequence sequence_display_unlock;
// Charging
extern const NotificationSequence sequence_charging;