From 24d181c3ffda77381e7d967492170caafdcee513 Mon Sep 17 00:00:00 2001 From: Leeroy <135471162+LeeroysHub@users.noreply.github.com> Date: Fri, 18 Sep 2026 14:07:36 +1000 Subject: [PATCH 1/2] Sub Decode not selected in Menu after Exit --- scenes/protopirate_scene_start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scenes/protopirate_scene_start.c b/scenes/protopirate_scene_start.c index 6765bfe..70b9b0f 100644 --- a/scenes/protopirate_scene_start.c +++ b/scenes/protopirate_scene_start.c @@ -87,6 +87,7 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) { bool consumed = false; if(event.type == SceneManagerEventTypeCustom) { + scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneStart, event.event); if(event.event == SubmenuIndexProtoPirateAbout) { scene_manager_next_scene(app->scene_manager, ProtoPirateSceneAbout); consumed = true; @@ -112,7 +113,6 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) { consumed = true; } #endif - scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneStart, event.event); } return consumed; From 9500c6d966bf4fd36751f31c877b89ccf06965dd Mon Sep 17 00:00:00 2001 From: Leeroy <135471162+LeeroysHub@users.noreply.github.com> Date: Fri, 18 Sep 2026 20:36:13 +1000 Subject: [PATCH 2/2] CLEANUP: Stop crashes when using Config Menu! The hopper now works, you can abuse presets and models as much as you like, and we never get reboots. --- helpers/protopirate_views.c | 8 ++++++++ helpers/protopirate_views.h | 1 + protopirate_app.c | 2 +- scenes/plugins/protopirate_config_plugin.c | 14 +++----------- scenes/plugins/protopirate_config_plugin.h | 1 - scenes/protopirate_scene_receiver.c | 3 +++ scenes/protopirate_scene_receiver_config.c | 3 --- scenes/protopirate_scene_start.c | 4 ++++ scenes/protopirate_scene_timing_tuner.c | 7 +++++++ 9 files changed, 27 insertions(+), 16 deletions(-) diff --git a/helpers/protopirate_views.c b/helpers/protopirate_views.c index 28af194..fc2b0a3 100644 --- a/helpers/protopirate_views.c +++ b/helpers/protopirate_views.c @@ -114,3 +114,11 @@ void protopirate_views_free(ProtoPirateApp* app) { app->protopirate_receiver = NULL; } } + +void protopirate_variable_item_list_free(ProtoPirateApp* app) { + if(app->variable_item_list) { + view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewVariableItemList); + variable_item_list_free(app->variable_item_list); + app->variable_item_list = NULL; + } +} diff --git a/helpers/protopirate_views.h b/helpers/protopirate_views.h index 63247ec..4c227a6 100644 --- a/helpers/protopirate_views.h +++ b/helpers/protopirate_views.h @@ -10,3 +10,4 @@ bool protopirate_ensure_text_input(ProtoPirateApp* app); bool protopirate_ensure_view_about(ProtoPirateApp* app); bool protopirate_ensure_receiver_view(ProtoPirateApp* app); void protopirate_views_free(ProtoPirateApp* app); +void protopirate_variable_item_list_free(ProtoPirateApp* app); diff --git a/protopirate_app.c b/protopirate_app.c index c769ff2..09cc8f6 100644 --- a/protopirate_app.c +++ b/protopirate_app.c @@ -66,7 +66,7 @@ bool config_plugin_load(ProtoPirateApp* app) { } const ProtoPirateConfigPlugin* plugin = plugin_manager_get_ep(manager, 0U); - if(!plugin || !plugin->on_enter || !plugin->on_exit) { + if(!plugin || !plugin->on_enter) { FURI_LOG_E(TAG, "Config plugin entry point is invalid"); plugin_manager_free(manager); composite_api_resolver_free(resolver); diff --git a/scenes/plugins/protopirate_config_plugin.c b/scenes/plugins/protopirate_config_plugin.c index 38b7b67..dd64996 100644 --- a/scenes/plugins/protopirate_config_plugin.c +++ b/scenes/plugins/protopirate_config_plugin.c @@ -35,8 +35,11 @@ const char* const tx_power_text[TX_POWER_COUNT] = { bool protopirate_ensure_variable_item_list(ProtoPirateApp* app) { furi_check(app); + if(app->variable_item_list) { view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewVariableItemList); + variable_item_list_free(app->variable_item_list); + //Reassigned below... app->variable_item_list = NULL; } app->variable_item_list = variable_item_list_alloc(); @@ -470,22 +473,11 @@ static void plugin_on_enter(void* context) { view_dispatcher_switch_to_view(app->view_dispatcher, ProtoPirateViewVariableItemList); } -static void plugin_on_exit(void* context) { - ProtoPirateApp* app = context; - - //Reset the variable item list. - variable_item_list_set_selected_item(app->variable_item_list, 0); - variable_item_list_reset(app->variable_item_list); - variable_item_list_free(app->variable_item_list); - //app->variable_item_list = NULL; -} - static const ProtoPirateConfigPlugin protopirate_config_plugin = { .plugin_name = "ProtoPirate Config", .car_model_get_by_index = car_model_get_by_index, .car_model_get_count = car_model_get_count, .on_enter = plugin_on_enter, - .on_exit = plugin_on_exit, }; static const FlipperAppPluginDescriptor protopirate_config_plugin_descriptor = { diff --git a/scenes/plugins/protopirate_config_plugin.h b/scenes/plugins/protopirate_config_plugin.h index 1507e1f..95d9462 100644 --- a/scenes/plugins/protopirate_config_plugin.h +++ b/scenes/plugins/protopirate_config_plugin.h @@ -31,5 +31,4 @@ typedef struct ProtoPirateConfigPlugin { SubGhzSetting* app_settings); uint16_t (*car_model_get_count)(void); void (*on_enter)(void* app); - void (*on_exit)(void* app); } ProtoPirateConfigPlugin; diff --git a/scenes/protopirate_scene_receiver.c b/scenes/protopirate_scene_receiver.c index 6d0af05..f08474c 100644 --- a/scenes/protopirate_scene_receiver.c +++ b/scenes/protopirate_scene_receiver.c @@ -338,6 +338,9 @@ void protopirate_scene_receiver_on_enter(void* context) { view_dispatcher_switch_to_view(app->view_dispatcher, ProtoPirateViewReceiver); view_dispatcher_send_custom_event( app->view_dispatcher, ProtoPirateCustomEventReceiverDeferredRxStart); + + //Kill Config if it exists now to save memory. + protopirate_variable_item_list_free(app); } static void protopirate_scene_receiver_handle_back(ProtoPirateApp* app) { diff --git a/scenes/protopirate_scene_receiver_config.c b/scenes/protopirate_scene_receiver_config.c index 77265b0..6bdb367 100644 --- a/scenes/protopirate_scene_receiver_config.c +++ b/scenes/protopirate_scene_receiver_config.c @@ -30,8 +30,5 @@ bool protopirate_scene_receiver_config_on_event(void* context, SceneManagerEvent void protopirate_scene_receiver_config_on_exit(void* context) { ProtoPirateApp* app = context; - if(app->config_plugin && app->config_plugin->on_exit) { - app->config_plugin->on_exit(app); - } config_plugin_unload(app); } diff --git a/scenes/protopirate_scene_start.c b/scenes/protopirate_scene_start.c index 70b9b0f..089724c 100644 --- a/scenes/protopirate_scene_start.c +++ b/scenes/protopirate_scene_start.c @@ -79,6 +79,9 @@ void protopirate_scene_start_on_enter(void* context) { app->submenu, scene_manager_get_scene_state(app->scene_manager, ProtoPirateSceneStart)); view_dispatcher_switch_to_view(app->view_dispatcher, ProtoPirateViewSubmenu); + + //Kill Config if it exists now to save memory. + protopirate_variable_item_list_free(app); } bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) { @@ -88,6 +91,7 @@ bool protopirate_scene_start_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { scene_manager_set_scene_state(app->scene_manager, ProtoPirateSceneStart, event.event); + FURI_LOG_I(TAG, "Suppressing Charging While in a scene."); if(event.event == SubmenuIndexProtoPirateAbout) { scene_manager_next_scene(app->scene_manager, ProtoPirateSceneAbout); consumed = true; diff --git a/scenes/protopirate_scene_timing_tuner.c b/scenes/protopirate_scene_timing_tuner.c index 9848e0c..8da432d 100644 --- a/scenes/protopirate_scene_timing_tuner.c +++ b/scenes/protopirate_scene_timing_tuner.c @@ -727,6 +727,13 @@ void protopirate_scene_timing_tuner_on_enter(void* context) { g_timing_ctx->is_receiving = true; view_dispatcher_switch_to_view(app->view_dispatcher, ProtoPirateViewAbout); + + //Kill Config if it exists now to save memory. + if(app->variable_item_list) { + view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewVariableItemList); + variable_item_list_free(app->variable_item_list); + app->variable_item_list = NULL; + } } bool protopirate_scene_timing_tuner_on_event(void* context, SceneManagerEvent event) {