From 181533df1b61c3beb79b71ee32a01d1432012305 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 19 Sep 2022 05:22:50 +0300 Subject: [PATCH] fixed bug with power suppress in unirf, removed icon from api --- applications/main/unirfremix/unirfremix_app.c | 24 +++++++++++-------- firmware/targets/f7/api_symbols.csv | 1 - 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/applications/main/unirfremix/unirfremix_app.c b/applications/main/unirfremix/unirfremix_app.c index 08bb5801f..cd9ef3992 100644 --- a/applications/main/unirfremix/unirfremix_app.c +++ b/applications/main/unirfremix/unirfremix_app.c @@ -845,6 +845,8 @@ void unirfremix_subghz_alloc(UniRFRemix* app) { UniRFRemix* unirfremix_alloc(void) { UniRFRemix* app = malloc(sizeof(UniRFRemix)); + furi_hal_power_suppress_charge_enter(); + app->model_mutex = furi_mutex_alloc(FuriMutexTypeNormal); app->input_queue = furi_message_queue_alloc(32, sizeof(InputEvent)); @@ -862,7 +864,9 @@ UniRFRemix* unirfremix_alloc(void) { return app; } -void unirfremix_free(UniRFRemix* app) { +void unirfremix_free(UniRFRemix* app, bool with_subghz) { + furi_hal_power_suppress_charge_exit(); + string_clear(app->up_file); string_clear(app->down_file); string_clear(app->left_file); @@ -888,10 +892,12 @@ void unirfremix_free(UniRFRemix* app) { furi_mutex_free(app->model_mutex); - furi_hal_subghz_sleep(); - subghz_setting_free(app->setting); - subghz_receiver_free(app->subghz_receiver); - subghz_environment_free(app->environment); + if(with_subghz) { + furi_hal_subghz_sleep(); + subghz_setting_free(app->setting); + subghz_receiver_free(app->subghz_receiver); + subghz_environment_free(app->environment); + } furi_record_close(RECORD_NOTIFICATION); app->notification = NULL; @@ -939,6 +945,8 @@ int32_t unirfremix_app(void* p) { furi_record_close(RECORD_DIALOGS); if(!res) { FURI_LOG_E(TAG, "No file selected"); + unirfremix_free(app, false); + return 255; } else { //check map and population variables unirfremix_cfg_set_check(app, app->file_path); @@ -970,8 +978,6 @@ int32_t unirfremix_app(void* p) { furi_mutex_release(app->model_mutex); view_port_update(app->view_port); - furi_hal_power_suppress_charge_enter(); - //input detect loop start InputEvent input; while(1) { @@ -1164,9 +1170,7 @@ int32_t unirfremix_app(void* p) { } // remove & free all stuff created by app - unirfremix_free(app); - - furi_hal_power_suppress_charge_exit(); + unirfremix_free(app, true); return 0; } \ No newline at end of file diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index e6041f744..2592e2b56 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -4090,7 +4090,6 @@ Variable,+,A_NFC_14,const Icon, Variable,+,A_Plugins_14,const Icon, Variable,+,A_Round_loader_8x8,const Icon, Variable,+,A_Settings_14,const Icon, -Variable,+,A_SpectrumAnalyzer_14,const Icon, Variable,+,A_Sub1ghz_14,const Icon, Variable,+,A_U2F_14,const Icon, Variable,+,A_UniRFRemix_14,const Icon,