diff --git a/applications/bt/bt_service/bt.c b/applications/bt/bt_service/bt.c index 5636cecebb9..111ebcb2470 100755 --- a/applications/bt/bt_service/bt.c +++ b/applications/bt/bt_service/bt.c @@ -60,7 +60,7 @@ static ViewPort* bt_pin_code_view_port_alloc(Bt* bt) { static void bt_pin_code_show(Bt* bt, uint32_t pin_code) { bt->pin_code = pin_code; - notification_message(bt->notification, &sequence_display_on); + notification_message(bt->notification, &sequence_display_backlight_on); gui_view_port_send_to_front(bt->gui, bt->pin_code_view_port); view_port_enabled_set(bt->pin_code_view_port, true); } @@ -74,7 +74,7 @@ static void bt_pin_code_hide(Bt* bt) { static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) { furi_assert(bt); - notification_message(bt->notification, &sequence_display_on); + notification_message(bt->notification, &sequence_display_backlight_on); string_t pin_str; dialog_message_set_icon(bt->dialog_message, &I_BLE_Pairing_128x64, 0, 0); string_init_printf(pin_str, "Verify code\n%06d", pin); diff --git a/applications/cli/cli_commands.c b/applications/cli/cli_commands.c index a58ddd49a74..bdec231b0b1 100644 --- a/applications/cli/cli_commands.c +++ b/applications/cli/cli_commands.c @@ -202,7 +202,7 @@ void cli_command_led(Cli* cli, string_t args, void* context) { } else if(!string_cmp(light_name, "b")) { notification_led_message.type = NotificationMessageTypeLedBlue; } else if(!string_cmp(light_name, "bl")) { - notification_led_message.type = NotificationMessageTypeLedDisplay; + notification_led_message.type = NotificationMessageTypeLedDisplayBacklight; } else { cli_print_usage("led", " <0-255>", string_get_cstr(args)); string_clear(light_name); diff --git a/applications/debug_tools/uart_echo.c b/applications/debug_tools/uart_echo.c index 73af1e664e7..0e4ee1d8976 100644 --- a/applications/debug_tools/uart_echo.c +++ b/applications/debug_tools/uart_echo.c @@ -45,7 +45,7 @@ typedef enum { #define WORKER_EVENTS_MASK (WorkerEventStop | WorkerEventRx) const NotificationSequence sequence_notification = { - &message_display_on, + &message_display_backlight_on, &message_green_255, &message_delay_10, NULL, diff --git a/applications/desktop/desktop.c b/applications/desktop/desktop.c index daaffc2db7a..7686a14568f 100644 --- a/applications/desktop/desktop.c +++ b/applications/desktop/desktop.c @@ -121,7 +121,7 @@ void desktop_lock(Desktop* desktop) { scene_manager_set_scene_state( desktop->scene_manager, DesktopSceneLocked, SCENE_LOCKED_FIRST_ENTER); scene_manager_next_scene(desktop->scene_manager, DesktopSceneLocked); - notification_message(desktop->notification, &sequence_display_off_delay_1000); + notification_message(desktop->notification, &sequence_display_backlight_off_delay_1000); } void desktop_unlock(Desktop* desktop) { diff --git a/applications/desktop/helpers/pin_lock.c b/applications/desktop/helpers/pin_lock.c index 4956c6cc306..00ac4177867 100644 --- a/applications/desktop/helpers/pin_lock.c +++ b/applications/desktop/helpers/pin_lock.c @@ -11,7 +11,7 @@ #include static const NotificationSequence sequence_pin_fail = { - &message_display_on, + &message_display_backlight_on, &message_red_255, &message_vibro_on, diff --git a/applications/desktop/scenes/desktop_scene_locked.c b/applications/desktop/scenes/desktop_scene_locked.c index 118bbce40a2..90df22269da 100644 --- a/applications/desktop/scenes/desktop_scene_locked.c +++ b/applications/desktop/scenes/desktop_scene_locked.c @@ -89,7 +89,7 @@ bool desktop_scene_locked_on_event(void* context, SceneManagerEvent event) { break; case DesktopLockedEventUpdate: if(desktop_view_locked_is_locked_hint_visible(desktop->locked_view)) { - notification_message(desktop->notification, &sequence_display_off); + notification_message(desktop->notification, &sequence_display_backlight_off); } desktop_view_locked_update(desktop->locked_view); consumed = true; diff --git a/applications/desktop/scenes/desktop_scene_pin_input.c b/applications/desktop/scenes/desktop_scene_pin_input.c index 7f9d8fcfb43..dd5c8ce382c 100644 --- a/applications/desktop/scenes/desktop_scene_pin_input.c +++ b/applications/desktop/scenes/desktop_scene_pin_input.c @@ -133,7 +133,7 @@ bool desktop_scene_pin_input_on_event(void* context, SceneManagerEvent event) { case DesktopPinInputEventBack: scene_manager_search_and_switch_to_previous_scene( desktop->scene_manager, DesktopSceneLocked); - notification_message(desktop->notification, &sequence_display_off); + notification_message(desktop->notification, &sequence_display_backlight_off); consumed = true; break; } diff --git a/applications/gpio/scenes/gpio_scene_usb_uart.c b/applications/gpio/scenes/gpio_scene_usb_uart.c index f8f473eeb74..aa41aaf9878 100644 --- a/applications/gpio/scenes/gpio_scene_usb_uart.c +++ b/applications/gpio/scenes/gpio_scene_usb_uart.c @@ -33,7 +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, GpioSceneUsbUart, 0); view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewUsbUart); - notification_message(app->notifications, &sequence_display_lock); + notification_message(app->notifications, &sequence_display_backlight_enforce_on); } bool gpio_scene_usb_uart_on_event(void* context, SceneManagerEvent event) { @@ -63,5 +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); + notification_message(app->notifications, &sequence_display_backlight_enforce_auto); } diff --git a/applications/notification/notification.h b/applications/notification/notification.h index b73efad20a9..4cb9dc5e020 100644 --- a/applications/notification/notification.h +++ b/applications/notification/notification.h @@ -50,9 +50,9 @@ typedef enum { NotificationMessageTypeDelay, - NotificationMessageTypeLedDisplay, - NotificationMessageTypeLedDisplayLock, - NotificationMessageTypeLedDisplayUnlock, + NotificationMessageTypeLedDisplayBacklight, + NotificationMessageTypeLedDisplayBacklightEnforceOn, + NotificationMessageTypeLedDisplayBacklightEnforceAuto, NotificationMessageTypeDoNotReset, diff --git a/applications/notification/notification_app.c b/applications/notification/notification_app.c index 75be20b1617..4db12bbf23e 100644 --- a/applications/notification/notification_app.c +++ b/applications/notification/notification_app.c @@ -152,7 +152,7 @@ void notification_sound_off() { static void notification_display_timer(void* ctx) { furi_assert(ctx); NotificationApp* app = ctx; - notification_message(app, &sequence_display_off); + notification_message(app, &sequence_display_backlight_off); } // message processing @@ -174,7 +174,7 @@ void notification_process_notification_message( while(notification_message != NULL) { switch(notification_message->type) { - case NotificationMessageTypeLedDisplay: + case NotificationMessageTypeLedDisplayBacklight: // if on - switch on and start timer // if off - switch off and stop timer // on timer - switch off @@ -190,7 +190,7 @@ void notification_process_notification_message( } reset_mask |= reset_display_mask; break; - case NotificationMessageTypeLedDisplayLock: + case NotificationMessageTypeLedDisplayBacklightEnforceOn: furi_assert(app->display_led_lock < UINT8_MAX); app->display_led_lock++; if(app->display_led_lock == 1) { @@ -199,7 +199,7 @@ void notification_process_notification_message( notification_message->data.led.value * display_brightness_setting); } break; - case NotificationMessageTypeLedDisplayUnlock: + case NotificationMessageTypeLedDisplayBacklightEnforceAuto: furi_assert(app->display_led_lock > 0); app->display_led_lock--; if(app->display_led_lock == 0) { @@ -322,7 +322,7 @@ void notification_process_internal_message(NotificationApp* app, NotificationApp while(notification_message != NULL) { switch(notification_message->type) { - case NotificationMessageTypeLedDisplay: + case NotificationMessageTypeLedDisplayBacklight: notification_apply_internal_led_layer( &app->display, notification_settings_get_display_brightness( @@ -442,7 +442,7 @@ static void input_event_callback(const void* value, void* context) { furi_assert(value); furi_assert(context); NotificationApp* app = context; - notification_message(app, &sequence_display_on); + notification_message(app, &sequence_display_backlight_on); } // App alloc @@ -482,7 +482,7 @@ static NotificationApp* notification_app_alloc() { // display backlight control app->event_record = furi_record_open("input_events"); furi_pubsub_subscribe(app->event_record, input_event_callback, app); - notification_message(app, &sequence_display_on); + notification_message(app, &sequence_display_backlight_on); return app; }; diff --git a/applications/notification/notification_messages.c b/applications/notification/notification_messages.c index 168c4d0f1d8..5a95556e373 100644 --- a/applications/notification/notification_messages.c +++ b/applications/notification/notification_messages.c @@ -4,24 +4,27 @@ /*********************************** Messages **********************************/ -// Display -const NotificationMessage message_display_on = { - .type = NotificationMessageTypeLedDisplay, +/** Display: backlight wakeup */ +const NotificationMessage message_display_backlight_on = { + .type = NotificationMessageTypeLedDisplayBacklight, .data.led.value = 0xFF, }; -const NotificationMessage message_display_off = { - .type = NotificationMessageTypeLedDisplay, +/** Display: backlight force off */ +const NotificationMessage message_display_backlight_off = { + .type = NotificationMessageTypeLedDisplayBacklight, .data.led.value = 0x00, }; -const NotificationMessage message_display_lock = { - .type = NotificationMessageTypeLedDisplayLock, +/** Display: backlight always on */ +const NotificationMessage message_display_backlight_enforce_on = { + .type = NotificationMessageTypeLedDisplayBacklightEnforceOn, .data.led.value = 0xFF, }; -const NotificationMessage message_display_unlock = { - .type = NotificationMessageTypeLedDisplayUnlock, +/** Display: automatic backlight management, with configured timeout */ +const NotificationMessage message_display_backlight_enforce_auto = { + .type = NotificationMessageTypeLedDisplayBacklightEnforceAuto, .data.led.value = 0x00, }; @@ -166,7 +169,7 @@ const NotificationSequence sequence_reset_rgb = { }; const NotificationSequence sequence_reset_display = { - &message_display_off, + &message_display_backlight_off, NULL, }; @@ -188,29 +191,31 @@ const NotificationSequence sequence_set_vibro_on = { }; // Display -const NotificationSequence sequence_display_on = { - &message_display_on, +const NotificationSequence sequence_display_backlight_on = { + &message_display_backlight_on, NULL, }; -const NotificationSequence sequence_display_off = { - &message_display_off, +const NotificationSequence sequence_display_backlight_off = { + &message_display_backlight_off, NULL, }; -const NotificationSequence sequence_display_lock = { - &message_display_lock, +/** Display: backlight always on lock */ +const NotificationSequence sequence_display_backlight_enforce_on = { + &message_display_backlight_enforce_on, NULL, }; -const NotificationSequence sequence_display_unlock = { - &message_display_unlock, +/** Display: backlight always on unlock */ +const NotificationSequence sequence_display_backlight_enforce_auto = { + &message_display_backlight_enforce_auto, NULL, }; -const NotificationSequence sequence_display_off_delay_1000 = { +const NotificationSequence sequence_display_backlight_off_delay_1000 = { &message_delay_1000, - &message_display_off, + &message_display_backlight_off, NULL, }; @@ -383,7 +388,7 @@ const NotificationSequence sequence_double_vibro = { }; const NotificationSequence sequence_success = { - &message_display_on, + &message_display_backlight_on, &message_green_255, &message_vibro_on, &message_note_c5, @@ -400,7 +405,7 @@ const NotificationSequence sequence_success = { }; const NotificationSequence sequence_error = { - &message_display_on, + &message_display_backlight_on, &message_red_255, &message_vibro_on, &message_note_c5, @@ -422,27 +427,27 @@ const NotificationSequence sequence_audiovisual_alert = { &message_force_display_brightness_setting_1f, &message_vibro_on, - &message_display_on, + &message_display_backlight_on, &message_note_c7, &message_delay_250, - &message_display_off, + &message_display_backlight_off, &message_note_c4, &message_delay_250, - &message_display_on, + &message_display_backlight_on, &message_note_c7, &message_delay_250, - &message_display_off, + &message_display_backlight_off, &message_note_c4, &message_delay_250, - &message_display_on, + &message_display_backlight_on, &message_note_c7, &message_delay_250, - &message_display_off, + &message_display_backlight_off, &message_note_c4, &message_delay_250, diff --git a/applications/notification/notification_messages.h b/applications/notification/notification_messages.h index 61044341302..c1ab340712b 100644 --- a/applications/notification/notification_messages.h +++ b/applications/notification/notification_messages.h @@ -9,15 +9,10 @@ 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; +extern const NotificationMessage message_display_backlight_on; +extern const NotificationMessage message_display_backlight_off; +extern const NotificationMessage message_display_backlight_enforce_on; +extern const NotificationMessage message_display_backlight_enforce_auto; // Led ON extern const NotificationMessage message_red_255; @@ -71,15 +66,16 @@ extern const NotificationSequence sequence_set_vibro_on; // Display /** Display: backlight wakeup */ -extern const NotificationSequence sequence_display_on; +extern const NotificationSequence sequence_display_backlight_on; /** Display: backlight force off */ -extern const NotificationSequence sequence_display_off; +extern const NotificationSequence sequence_display_backlight_off; +/** Display: backlight force off after a delay of 1000ms */ +extern const NotificationSequence sequence_display_backlight_off_delay_1000; + /** Display: backlight always on lock */ -extern const NotificationSequence sequence_display_lock; +extern const NotificationSequence sequence_display_backlight_enforce_on; /** Display: backlight always on unlock */ -extern const NotificationSequence sequence_display_unlock; -/** Display: backlight force off after a delay of 1000ms */ -extern const NotificationSequence sequence_display_off_delay_1000; +extern const NotificationSequence sequence_display_backlight_enforce_auto; // Charging extern const NotificationSequence sequence_charging; diff --git a/applications/notification/notification_settings_app.c b/applications/notification/notification_settings_app.c index e7a57aa6138..eef14ebf5e3 100644 --- a/applications/notification/notification_settings_app.c +++ b/applications/notification/notification_settings_app.c @@ -70,7 +70,7 @@ static void backlight_changed(VariableItem* item) { variable_item_set_current_value_text(item, backlight_text[index]); app->notification->settings.display_brightness = backlight_value[index]; - notification_message(app->notification, &sequence_display_on); + notification_message(app->notification, &sequence_display_backlight_on); } static void screen_changed(VariableItem* item) { @@ -79,7 +79,7 @@ static void screen_changed(VariableItem* item) { variable_item_set_current_value_text(item, delay_text[index]); app->notification->settings.display_off_delay_ms = delay_value[index]; - notification_message(app->notification, &sequence_display_on); + notification_message(app->notification, &sequence_display_backlight_on); } const NotificationMessage apply_message = { diff --git a/applications/power/battery_test_app/battery_test_app.c b/applications/power/battery_test_app/battery_test_app.c index 4d73fee5435..1588a525fc2 100755 --- a/applications/power/battery_test_app/battery_test_app.c +++ b/applications/power/battery_test_app/battery_test_app.c @@ -28,7 +28,7 @@ static void battery_test_battery_info_update_model(void* context) { .health = app->info.health, }; battery_info_set_data(app->batery_info, &battery_info_data); - notification_message(app->notifications, &sequence_display_on); + notification_message(app->notifications, &sequence_display_backlight_on); } BatteryTestApp* battery_test_alloc() { diff --git a/applications/u2f/scenes/u2f_scene_main.c b/applications/u2f/scenes/u2f_scene_main.c index dadecb36271..d0957b5915c 100644 --- a/applications/u2f/scenes/u2f_scene_main.c +++ b/applications/u2f/scenes/u2f_scene_main.c @@ -59,7 +59,7 @@ bool u2f_scene_main_on_event(void* context, SceneManagerEvent event) { u2f_view_set_state(app->u2f_view, U2fMsgRegister); else if(event.event == U2fCustomEventAuth) u2f_view_set_state(app->u2f_view, U2fMsgAuth); - notification_message(app->notifications, &sequence_display_on); + notification_message(app->notifications, &sequence_display_backlight_on); notification_message(app->notifications, &sequence_single_vibro); } notification_message(app->notifications, &sequence_blink_magenta_10); diff --git a/applications/updater/scenes/updater_scene_main.c b/applications/updater/scenes/updater_scene_main.c index 165028c4cfc..c5fc99ffb9b 100644 --- a/applications/updater/scenes/updater_scene_main.c +++ b/applications/updater/scenes/updater_scene_main.c @@ -25,6 +25,7 @@ static void sd_mount_callback(const void* message, void* context) { void updater_scene_main_on_enter(void* context) { Updater* updater = (Updater*)context; + notification_message(updater->notification, &sequence_display_backlight_enforce_on); UpdaterMainView* main_view = updater->main_view; FuriPubSubSubscription* sub = @@ -92,8 +93,9 @@ bool updater_scene_main_on_event(void* context, SceneManagerEvent event) { void updater_scene_main_on_exit(void* context) { Updater* updater = (Updater*)context; + notification_message(updater->notification, &sequence_display_backlight_enforce_auto); furi_pubsub_unsubscribe( storage_get_pubsub(updater->storage), updater_main_get_storage_pubsub(updater->main_view)); scene_manager_set_scene_state(updater->scene_manager, UpdaterSceneMain, 0); -} \ No newline at end of file +} diff --git a/applications/updater/updater.c b/applications/updater/updater.c index 519ba167da6..c1115ce1830 100644 --- a/applications/updater/updater.c +++ b/applications/updater/updater.c @@ -47,6 +47,7 @@ Updater* updater_alloc(const char* arg) { } updater->storage = furi_record_open("storage"); + updater->notification = furi_record_open("notification"); updater->gui = furi_record_open("gui"); updater->view_dispatcher = view_dispatcher_alloc(); @@ -119,6 +120,7 @@ void updater_free(Updater* updater) { furi_record_close("gui"); furi_record_close("storage"); + furi_record_close("notification"); free(updater); } diff --git a/applications/updater/updater_i.h b/applications/updater/updater_i.h index d0e7c77c97c..89201e1e0aa 100644 --- a/applications/updater/updater_i.h +++ b/applications/updater/updater_i.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #ifdef __cplusplus @@ -41,6 +42,7 @@ typedef struct UpdaterManifestProcessingState { typedef struct { // GUI Gui* gui; + NotificationApp* notification; SceneManager* scene_manager; ViewDispatcher* view_dispatcher; Storage* storage; diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c index 4439a713355..5711d2c0023 100644 --- a/lib/infrared/worker/infrared_worker.c +++ b/lib/infrared/worker/infrared_worker.c @@ -177,7 +177,7 @@ static int32_t infrared_worker_rx_thread(void* thread_context) { notification_message(instance->notification, &sequence_blink_blue_10); } if(instance->signal.timings_cnt == 0) - notification_message(instance->notification, &sequence_display_on); + notification_message(instance->notification, &sequence_display_backlight_on); while(sizeof(LevelDuration) == xStreamBufferReceive( instance->stream, &level_duration, sizeof(LevelDuration), 0)) {