From cb7d43f7e1464ed3276a2772b7a0142f9252f181 Mon Sep 17 00:00:00 2001 From: Skorpionm <85568270+Skorpionm@users.noreply.github.com> Date: Fri, 1 Apr 2022 15:10:21 +0400 Subject: [PATCH] [FL-2410] SubGhz: fix launching an incorrect Sub-GHz key from the archive. (#1080) --- applications/subghz/subghz.c | 30 ++++++++++++++++++------------ applications/subghz/subghz_i.c | 1 - 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c index 0fb2f6d9..a6c6e24f 100644 --- a/applications/subghz/subghz.c +++ b/applications/subghz/subghz.c @@ -309,20 +309,26 @@ int32_t subghz_app(void* p) { subghz_environment_load_keystore( subghz->txrx->environment, "/ext/subghz/assets/keeloq_mfcodes_user"); // Check argument and run corresponding scene - if(p && subghz_key_load(subghz, p)) { - string_t filename; - string_init(filename); + if(p) { + if(subghz_key_load(subghz, p)) { + string_t filename; + string_init(filename); - path_extract_filename_no_ext(p, filename); - strcpy(subghz->file_name, string_get_cstr(filename)); - string_clear(filename); - if((!strcmp(subghz->txrx->decoder_result->protocol->name, "RAW"))) { - //Load Raw TX - subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad; - scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW); + path_extract_filename_no_ext(p, filename); + strcpy(subghz->file_name, string_get_cstr(filename)); + string_clear(filename); + if((!strcmp(subghz->txrx->decoder_result->protocol->name, "RAW"))) { + //Load Raw TX + subghz->txrx->rx_key_state = SubGhzRxKeyStateRAWLoad; + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneReadRAW); + } else { + //Load transmitter TX + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter); + } } else { - //Load transmitter TX - scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter); + //exit app + scene_manager_stop(subghz->scene_manager); + view_dispatcher_stop(subghz->view_dispatcher); } } else { if(load_database) { diff --git a/applications/subghz/subghz_i.c b/applications/subghz/subghz_i.c index 56ce7e97..01ecebe8 100755 --- a/applications/subghz/subghz_i.c +++ b/applications/subghz/subghz_i.c @@ -277,7 +277,6 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path) { } string_clear(temp_str); - //string_clear(path); flipper_format_free(fff_data_file); furi_record_close("storage");