mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-27 06:50:21 +00:00
Notification: backlight always on lock. Gpio: backlight always on lock in uart brige app. (#1007)
This commit is contained in:
parent
3c77ae2eb8
commit
92734f1bb3
6 changed files with 65 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -40,14 +40,22 @@ typedef union {
|
|||
|
||||
typedef enum {
|
||||
NotificationMessageTypeVibro,
|
||||
|
||||
NotificationMessageTypeSoundOn,
|
||||
NotificationMessageTypeSoundOff,
|
||||
|
||||
NotificationMessageTypeLedRed,
|
||||
NotificationMessageTypeLedGreen,
|
||||
NotificationMessageTypeLedBlue,
|
||||
|
||||
NotificationMessageTypeDelay,
|
||||
|
||||
NotificationMessageTypeLedDisplay,
|
||||
NotificationMessageTypeLedDisplayLock,
|
||||
NotificationMessageTypeLedDisplayUnlock,
|
||||
|
||||
NotificationMessageTypeDoNotReset,
|
||||
|
||||
NotificationMessageTypeForceSpeakerVolumeSetting,
|
||||
NotificationMessageTypeForceVibroSetting,
|
||||
NotificationMessageTypeForceDisplayBrightnessSetting,
|
||||
|
@ -83,4 +91,4 @@ void notification_internal_message_block(
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -53,4 +53,4 @@ struct NotificationApp {
|
|||
NotificationSettings settings;
|
||||
};
|
||||
|
||||
void notification_message_save_settings(NotificationApp* app);
|
||||
void notification_message_save_settings(NotificationApp* app);
|
||||
|
|
|
@ -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,
|
||||
|
@ -416,4 +436,4 @@ const NotificationSequence sequence_audiovisual_alert = {
|
|||
&message_sound_off,
|
||||
&message_vibro_off,
|
||||
NULL,
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue