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); 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); scene_manager_set_scene_state(app->scene_manager, GpioAppViewUsbUart, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewUsbUart); 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) { 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); usb_uart_disable(app->usb_uart_bridge);
free(scene_usb_uart); free(scene_usb_uart);
} }
notification_message(app->notifications, &sequence_display_unlock);
} }

View File

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

View File

@ -163,6 +163,7 @@ void notification_process_notification_message(
notification_message = (*message->sequence)[notification_message_index]; notification_message = (*message->sequence)[notification_message_index];
bool led_active = false; bool led_active = false;
uint8_t display_led_lock = 0;
uint8_t led_values[NOTIFICATION_LED_COUNT] = {0x00, 0x00, 0x00}; uint8_t led_values[NOTIFICATION_LED_COUNT] = {0x00, 0x00, 0x00};
bool reset_notifications = true; bool reset_notifications = true;
float speaker_volume_setting = app->settings.speaker_volume; float speaker_volume_setting = app->settings.speaker_volume;
@ -189,6 +190,24 @@ void notification_process_notification_message(
} }
reset_mask |= reset_display_mask; reset_mask |= reset_display_mask;
break; 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: case NotificationMessageTypeLedRed:
// store and send on delay or after seq // store and send on delay or after seq
led_active = true; led_active = true;

View File

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

View File

@ -9,8 +9,15 @@ extern "C" {
/*********************************** Messages **********************************/ /*********************************** Messages **********************************/
// Display // Display
/** Display: backlight wakeup */
extern const NotificationMessage message_display_on; extern const NotificationMessage message_display_on;
/** Display: backlight force off */
extern const NotificationMessage message_display_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 // Led ON
extern const NotificationMessage message_red_255; extern const NotificationMessage message_red_255;
@ -63,8 +70,14 @@ extern const NotificationSequence sequence_reset_vibro;
extern const NotificationSequence sequence_set_vibro_on; extern const NotificationSequence sequence_set_vibro_on;
// Display // Display
/** Display: backlight wakeup */
extern const NotificationSequence sequence_display_on; extern const NotificationSequence sequence_display_on;
/** Display: backlight force off */
extern const NotificationSequence sequence_display_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 // Charging
extern const NotificationSequence sequence_charging; extern const NotificationSequence sequence_charging;