[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:
@@ -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) {
|
||||
}
|
@@ -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)
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user