Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Aug 27, 2022
2 parents ab5bcd7 + eb28dc2 commit a6597da
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions applications/gui/modules/button_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ ButtonPanel* button_panel_alloc() {
return button_panel;
}

void button_panel_reset_selection(ButtonPanel* button_panel) {
with_view_model(
button_panel->view, (ButtonPanelModel * model) {
model->selected_item_x = 0;
model->selected_item_y = 0;
return true;
});
}

void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y) {
furi_check(reserve_x > 0);
furi_check(reserve_y > 0);
Expand Down
6 changes: 6 additions & 0 deletions applications/gui/modules/button_panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ void button_panel_free(ButtonPanel* button_panel);
*/
void button_panel_reset(ButtonPanel* button_panel);

/** Resets selected_item_x and selected_item_y.
*
* @param button_panel ButtonPanel instance
*/
void button_panel_reset_selection(ButtonPanel* button_panel);

/** Reserve space for adding items.
*
* One does not simply use button_panel_add_item() without this function. It
Expand Down
4 changes: 4 additions & 0 deletions applications/infrared/infrared_brute_force.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ InfraredBruteForce* infrared_brute_force_alloc() {
return brute_force;
}

void infrared_brute_force_clear_records(InfraredBruteForce* brute_force) {
InfraredBruteForceRecordDict_reset(brute_force->records);
}

void infrared_brute_force_free(InfraredBruteForce* brute_force) {
furi_assert(!brute_force->ff);
InfraredBruteForceRecordDict_clear(brute_force->records);
Expand Down
1 change: 1 addition & 0 deletions applications/infrared/infrared_brute_force.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ bool infrared_brute_force_start(
bool infrared_brute_force_is_started(InfraredBruteForce* brute_force);
void infrared_brute_force_stop(InfraredBruteForce* brute_force);
bool infrared_brute_force_send_next(InfraredBruteForce* brute_force);
void infrared_brute_force_clear_records(InfraredBruteForce* brute_force);
void infrared_brute_force_add_record(
InfraredBruteForce* brute_force,
uint32_t index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ static void infrared_scene_universal_common_hide_popup(Infrared* infrared) {

void infrared_scene_universal_common_on_enter(void* context) {
Infrared* infrared = context;
infrared_brute_force_clear_records(infrared->brute_force);
button_panel_reset_selection(infrared->button_panel);
view_stack_add_view(infrared->view_stack, button_panel_get_view(infrared->button_panel));
}

Expand Down

0 comments on commit a6597da

Please sign in to comment.