From ef0300d239026da47b2315dd3278ec99826600e1 Mon Sep 17 00:00:00 2001 From: Skorpionm <85568270+Skorpionm@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:45:31 +0400 Subject: [PATCH] [FL-3840] SubGhz: fix gui "No transition to the "Saved" menu when deleting a SubGHz RAW file" (#3695) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * SubGhz: fix gui "No transition to the "Saved" menu when deleting a SubGHz RAW file" * SubGhz: remove dead code Co-authored-by: あく --- applications/main/subghz/helpers/subghz_types.h | 1 + applications/main/subghz/scenes/subghz_scene_delete_raw.c | 8 +++++++- applications/main/subghz/scenes/subghz_scene_read_raw.c | 8 ++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/applications/main/subghz/helpers/subghz_types.h b/applications/main/subghz/helpers/subghz_types.h index e71c22dd5..5c17dc3d4 100644 --- a/applications/main/subghz/helpers/subghz_types.h +++ b/applications/main/subghz/helpers/subghz_types.h @@ -52,6 +52,7 @@ typedef enum { SubGhzRxKeyStateAddKey, SubGhzRxKeyStateExit, SubGhzRxKeyStateRAWLoad, + SubGhzRxKeyStateRAWMore, SubGhzRxKeyStateRAWSave, } SubGhzRxKeyState; diff --git a/applications/main/subghz/scenes/subghz_scene_delete_raw.c b/applications/main/subghz/scenes/subghz_scene_delete_raw.c index 53f13b68e..5862ad7c7 100644 --- a/applications/main/subghz/scenes/subghz_scene_delete_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_delete_raw.c @@ -58,7 +58,13 @@ bool subghz_scene_delete_raw_on_event(void* context, SceneManagerEvent event) { if(event.event == SubGhzCustomEventSceneDeleteRAW) { furi_string_set(subghz->file_path_tmp, subghz->file_path); if(subghz_delete_file(subghz)) { - scene_manager_next_scene(subghz->scene_manager, SubGhzSceneDeleteSuccess); + if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateRAWLoad) { + subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE); + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneDeleteSuccess); + } else { + scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaved); + } + } else { scene_manager_search_and_switch_to_previous_scene( subghz->scene_manager, SubGhzSceneStart); diff --git a/applications/main/subghz/scenes/subghz_scene_read_raw.c b/applications/main/subghz/scenes/subghz_scene_read_raw.c index a0578ff95..b12c94681 100644 --- a/applications/main/subghz/scenes/subghz_scene_read_raw.c +++ b/applications/main/subghz/scenes/subghz_scene_read_raw.c @@ -77,6 +77,7 @@ void subghz_scene_read_raw_on_enter(void* context) { subghz->subghz_read_raw, SubGhzReadRAWStatusIDLE, "", threshold_rssi); break; case SubGhzRxKeyStateRAWLoad: + case SubGhzRxKeyStateRAWMore: path_extract_filename(subghz->file_path, file_name, true); subghz_read_raw_set_status( subghz->subghz_read_raw, @@ -98,7 +99,8 @@ void subghz_scene_read_raw_on_enter(void* context) { break; } - if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateBack) { + if((subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateBack) && + (subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateRAWLoad)) { subghz_rx_key_state_set(subghz, SubGhzRxKeyStateIDLE); } furi_string_free(file_name); @@ -177,7 +179,9 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) { if(subghz_scene_read_raw_update_filename(subghz)) { scene_manager_set_scene_state( subghz->scene_manager, SubGhzSceneReadRAW, SubGhzCustomEventManagerSet); - subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWLoad); + if(subghz_rx_key_state_get(subghz) != SubGhzRxKeyStateRAWLoad) { + subghz_rx_key_state_set(subghz, SubGhzRxKeyStateRAWMore); + } scene_manager_next_scene(subghz->scene_manager, SubGhzSceneMoreRAW); consumed = true; } else {