From 17d01f5c297808cc7ca9735d6a6cf40cf7c1f199 Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Thu, 22 Sep 2022 19:13:00 +0300 Subject: [PATCH] [FL-2848] Universal Remote fix (#1770) * Reset BruteForce on exit from Universal Remote * Reset current button in ButtonPanel --- applications/main/infrared/infrared_brute_force.c | 4 ++++ applications/main/infrared/infrared_brute_force.h | 1 + .../infrared/scenes/common/infrared_scene_universal_common.c | 1 + applications/services/gui/modules/button_panel.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/applications/main/infrared/infrared_brute_force.c b/applications/main/infrared/infrared_brute_force.c index 8dbc23012..575fa05ec 100644 --- a/applications/main/infrared/infrared_brute_force.c +++ b/applications/main/infrared/infrared_brute_force.c @@ -153,3 +153,7 @@ void infrared_brute_force_add_record( InfraredBruteForceRecordDict_set_at(brute_force->records, key, value); string_clear(key); } + +void infrared_brute_force_reset(InfraredBruteForce* brute_force) { + InfraredBruteForceRecordDict_reset(brute_force->records); +} diff --git a/applications/main/infrared/infrared_brute_force.h b/applications/main/infrared/infrared_brute_force.h index acf0d7b6e..042d1556b 100644 --- a/applications/main/infrared/infrared_brute_force.h +++ b/applications/main/infrared/infrared_brute_force.h @@ -20,3 +20,4 @@ void infrared_brute_force_add_record( InfraredBruteForce* brute_force, uint32_t index, const char* name); +void infrared_brute_force_reset(InfraredBruteForce* brute_force); diff --git a/applications/main/infrared/scenes/common/infrared_scene_universal_common.c b/applications/main/infrared/scenes/common/infrared_scene_universal_common.c index 57ac81168..f823ca931 100644 --- a/applications/main/infrared/scenes/common/infrared_scene_universal_common.c +++ b/applications/main/infrared/scenes/common/infrared_scene_universal_common.c @@ -87,5 +87,6 @@ void infrared_scene_universal_common_on_exit(void* context) { Infrared* infrared = context; ButtonPanel* button_panel = infrared->button_panel; view_stack_remove_view(infrared->view_stack, button_panel_get_view(button_panel)); + infrared_brute_force_reset(infrared->brute_force); button_panel_reset(button_panel); } diff --git a/applications/services/gui/modules/button_panel.c b/applications/services/gui/modules/button_panel.c index e3ae59a36..c823e4b18 100644 --- a/applications/services/gui/modules/button_panel.c +++ b/applications/services/gui/modules/button_panel.c @@ -133,6 +133,8 @@ void button_panel_reset(ButtonPanel* button_panel) { } model->reserve_x = 0; model->reserve_y = 0; + model->selected_item_x = 0; + model->selected_item_y = 0; LabelList_reset(model->labels); ButtonMatrix_reset(model->button_matrix); return true;