Skip to content

Commit

Permalink
misc tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jaylikesbunda committed Jan 12, 2025
1 parent 08d342a commit 3ef4488
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 4 additions & 3 deletions applications/main/infrared/scenes/infrared_scene_learn.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static void infrared_scene_learn_dialog_result_callback(DialogExResult result, v
static void infrared_scene_learn_update_button_name(InfraredApp* infrared, bool increment) {
DialogEx* dialog_ex = infrared->dialog_ex;
int32_t button_index;

if(infrared->app_state.is_learning_new_remote) {
// For new remotes, use current_button_index directly
button_index = infrared->app_state.current_button_index;
Expand Down Expand Up @@ -80,7 +80,8 @@ void infrared_scene_learn_on_enter(void* context) {
infrared_scene_learn_update_button_name(infrared, false);
dialog_ex_set_icon(dialog_ex, 0, 22, &I_InfraredLearnShort_128x31);
// Only show skip if not at last button
if(infrared->app_state.current_button_index + 1 < (int32_t)COUNT_OF(easy_mode_button_names)) {
if(infrared->app_state.current_button_index + 1 <
(int32_t)COUNT_OF(easy_mode_button_names)) {
dialog_ex_set_center_button_text(dialog_ex, "Skip");
}
} else {
Expand Down Expand Up @@ -125,7 +126,7 @@ bool infrared_scene_learn_on_event(void* context, SceneManagerEvent event) {

void infrared_scene_learn_on_exit(void* context) {
InfraredApp* infrared = context;

// Reset dialog
dialog_ex_reset(infrared->dialog_ex);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ static const char* const easy_mode_button_names[] = {"Power", "Vol_up", "Vol_dn"
"Pause", "Stop", "Prev", "Next", "Rew",
"FF", "Exit", "Menu"};


void infrared_scene_learn_enter_name_on_enter(void* context) {
InfraredApp* infrared = context;
TextInput* text_input = infrared->text_input;
Expand Down
10 changes: 9 additions & 1 deletion applications/main/infrared/scenes/infrared_scene_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ void infrared_scene_start_on_enter(void* context) {
const uint32_t submenu_index =
scene_manager_get_scene_state(scene_manager, InfraredSceneStart);
submenu_set_selected_item(submenu, submenu_index);
scene_manager_set_scene_state(scene_manager, InfraredSceneStart, SubmenuIndexUniversalRemotes);

// Only reset menu position if we're not coming from a toggle
if(submenu_index == 0) {
scene_manager_set_scene_state(
scene_manager, InfraredSceneStart, SubmenuIndexUniversalRemotes);
}

view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewSubmenu);
}
Expand All @@ -99,6 +104,9 @@ bool infrared_scene_start_on_event(void* context, SceneManagerEvent event) {
if(event.event == SubmenuIndexEasyLearn) {
infrared->app_state.is_easy_mode = !infrared->app_state.is_easy_mode;
infrared_save_settings(infrared);
// Save current position
scene_manager_set_scene_state(
scene_manager, InfraredSceneStart, SubmenuIndexEasyLearn);
scene_manager_previous_scene(scene_manager);
scene_manager_next_scene(scene_manager, InfraredSceneStart);
consumed = true;
Expand Down

0 comments on commit 3ef4488

Please sign in to comment.