|
@@ -32,9 +32,15 @@ Evil_PortalApp* evil_portal_app_alloc() {
|
|
|
app->command_index = 0;
|
|
app->command_index = 0;
|
|
|
app->portal_logs = furi_string_alloc();
|
|
app->portal_logs = furi_string_alloc();
|
|
|
|
|
|
|
|
|
|
+ app->dialogs = furi_record_open(RECORD_DIALOGS);
|
|
|
|
|
+ app->file_path = furi_string_alloc();
|
|
|
|
|
+
|
|
|
app->gui = furi_record_open(RECORD_GUI);
|
|
app->gui = furi_record_open(RECORD_GUI);
|
|
|
|
|
|
|
|
app->view_dispatcher = view_dispatcher_alloc();
|
|
app->view_dispatcher = view_dispatcher_alloc();
|
|
|
|
|
+
|
|
|
|
|
+ app->loading = loading_alloc();
|
|
|
|
|
+
|
|
|
app->scene_manager = scene_manager_alloc(&evil_portal_scene_handlers, app);
|
|
app->scene_manager = scene_manager_alloc(&evil_portal_scene_handlers, app);
|
|
|
view_dispatcher_enable_queue(app->view_dispatcher);
|
|
view_dispatcher_enable_queue(app->view_dispatcher);
|
|
|
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
|
|
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
|
|
@@ -48,12 +54,18 @@ Evil_PortalApp* evil_portal_app_alloc() {
|
|
|
|
|
|
|
|
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
|
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
|
|
|
|
|
|
|
|
|
|
+ app->view_stack = view_stack_alloc();
|
|
|
|
|
+
|
|
|
app->var_item_list = variable_item_list_alloc();
|
|
app->var_item_list = variable_item_list_alloc();
|
|
|
view_dispatcher_add_view(
|
|
view_dispatcher_add_view(
|
|
|
app->view_dispatcher,
|
|
app->view_dispatcher,
|
|
|
Evil_PortalAppViewVarItemList,
|
|
Evil_PortalAppViewVarItemList,
|
|
|
variable_item_list_get_view(app->var_item_list));
|
|
variable_item_list_get_view(app->var_item_list));
|
|
|
|
|
|
|
|
|
|
+ app->text_input = text_input_alloc();
|
|
|
|
|
+ view_dispatcher_add_view(
|
|
|
|
|
+ app->view_dispatcher, Evil_PortalAppViewTextInput, text_input_get_view(app->text_input));
|
|
|
|
|
+
|
|
|
for(int i = 0; i < NUM_MENU_ITEMS; ++i) {
|
|
for(int i = 0; i < NUM_MENU_ITEMS; ++i) {
|
|
|
app->selected_option_index[i] = 0;
|
|
app->selected_option_index[i] = 0;
|
|
|
}
|
|
}
|
|
@@ -88,6 +100,10 @@ void evil_portal_app_free(Evil_PortalApp* app) {
|
|
|
|
|
|
|
|
text_box_free(app->text_box);
|
|
text_box_free(app->text_box);
|
|
|
furi_string_free(app->text_box_store);
|
|
furi_string_free(app->text_box_store);
|
|
|
|
|
+ text_input_free(app->text_input);
|
|
|
|
|
+
|
|
|
|
|
+ view_stack_free(app->view_stack);
|
|
|
|
|
+ loading_free(app->loading);
|
|
|
|
|
|
|
|
// View dispatcher
|
|
// View dispatcher
|
|
|
view_dispatcher_free(app->view_dispatcher);
|
|
view_dispatcher_free(app->view_dispatcher);
|
|
@@ -98,20 +114,14 @@ void evil_portal_app_free(Evil_PortalApp* app) {
|
|
|
// Close records
|
|
// Close records
|
|
|
furi_record_close(RECORD_GUI);
|
|
furi_record_close(RECORD_GUI);
|
|
|
|
|
|
|
|
|
|
+ furi_record_close(RECORD_DIALOGS);
|
|
|
|
|
+ furi_string_free(app->file_path);
|
|
|
|
|
+
|
|
|
free(app);
|
|
free(app);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
int32_t evil_portal_app(void* p) {
|
|
int32_t evil_portal_app(void* p) {
|
|
|
UNUSED(p);
|
|
UNUSED(p);
|
|
|
-
|
|
|
|
|
- // Enable 5v on startup
|
|
|
|
|
- uint8_t attempts = 0;
|
|
|
|
|
- while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
|
|
|
|
|
- furi_hal_power_enable_otg();
|
|
|
|
|
- furi_delay_ms(10);
|
|
|
|
|
- }
|
|
|
|
|
- furi_delay_ms(200);
|
|
|
|
|
-
|
|
|
|
|
Evil_PortalApp* evil_portal_app = evil_portal_app_alloc();
|
|
Evil_PortalApp* evil_portal_app = evil_portal_app_alloc();
|
|
|
|
|
|
|
|
evil_portal_app->uart = evil_portal_uart_init(evil_portal_app);
|
|
evil_portal_app->uart = evil_portal_uart_init(evil_portal_app);
|
|
@@ -120,9 +130,5 @@ int32_t evil_portal_app(void* p) {
|
|
|
|
|
|
|
|
evil_portal_app_free(evil_portal_app);
|
|
evil_portal_app_free(evil_portal_app);
|
|
|
|
|
|
|
|
- if(furi_hal_power_is_otg_enabled()) {
|
|
|
|
|
- furi_hal_power_disable_otg();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|