[FL-1905] Fix power off notification (#748)

* view dispatcher: add set view front API
* power: add power off notification
* Gui: rename ViewPort `send_to` API.
* Makefile: add blackmagick support

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-10-06 18:41:22 +03:00
committed by GitHub
parent c8b36dd406
commit 5232d5daba
12 changed files with 66 additions and 34 deletions

View File

@@ -1,17 +0,0 @@
#include "../power_settings_app.h"
void power_settings_scene_usb_disconnect_on_enter(void* context) {
PowerSettingsApp* app = context;
dialog_ex_set_header(
app->dialog, "Disconnect USB for safe\nshutdown", 64, 26, AlignCenter, AlignTop);
view_dispatcher_switch_to_view(app->view_dispatcher, PowerSettingsAppViewDialog);
}
bool power_settings_scene_usb_disconnect_on_event(void* context, SceneManagerEvent event) {
return true;
}
void power_settings_scene_usb_disconnect_on_exit(void* context) {
}

View File

@@ -2,4 +2,3 @@ ADD_SCENE(power_settings, start, Start)
ADD_SCENE(power_settings, battery_info, BatteryInfo)
ADD_SCENE(power_settings, reboot, Reboot)
ADD_SCENE(power_settings, power_off, PowerOff)
ADD_SCENE(power_settings, usb_disconnect, UsbDisconnect)

View File

@@ -30,12 +30,7 @@ bool power_settings_scene_power_off_on_event(void* context, SceneManagerEvent ev
if(event.event == DialogExResultLeft) {
scene_manager_previous_scene(app->scene_manager);
} else if(event.event == DialogExResultRight) {
power_off();
// Check if USB is connected
power_get_info(app->power, &app->info);
if(app->info.voltage_vbus > 4.0f) {
scene_manager_next_scene(app->scene_manager, PowerSettingsAppSceneUsbDisconnect);
}
power_off(app->power);
}
consumed = true;
}