menu_data_reset()
This commit is contained in:
parent
40ebd455f2
commit
355b003b7f
3 changed files with 12 additions and 9 deletions
Firmware
|
@ -39,6 +39,12 @@ menu_func_t menu_menu = 0;
|
|||
|
||||
static_assert(sizeof(menu_data)>= sizeof(menu_data_edit_t),"menu_data_edit_t doesn't fit into menu_data");
|
||||
|
||||
void menu_data_reset(void)
|
||||
{
|
||||
// Resets the global shared C union.
|
||||
// This ensures, that the menu entered will find out, that it shall initialize itself.
|
||||
memset(&menu_data, 0, sizeof(menu_data));
|
||||
}
|
||||
|
||||
void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bool reset_menu_state)
|
||||
{
|
||||
|
@ -49,11 +55,8 @@ void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bo
|
|||
lcd_encoder = encoder;
|
||||
CRITICAL_SECTION_END;
|
||||
if (reset_menu_state)
|
||||
{
|
||||
// Resets the global shared C union.
|
||||
// This ensures, that the menu entered will find out, that it shall initialize itself.
|
||||
memset(&menu_data, 0, sizeof(menu_data));
|
||||
}
|
||||
menu_data_reset();
|
||||
|
||||
if (feedback) lcd_quick_feedback();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -64,7 +64,7 @@ extern uint8_t menu_leaving;
|
|||
//function pointer to the currently active menu
|
||||
extern menu_func_t menu_menu;
|
||||
|
||||
|
||||
extern void menu_data_reset(void);
|
||||
|
||||
extern void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bool reset_menu_state);
|
||||
|
||||
|
|
|
@ -7100,7 +7100,7 @@ static void lcd_sd_refresh()
|
|||
#endif
|
||||
menu_top = 0;
|
||||
lcd_encoder = 0;
|
||||
memset(&menu_data, 0, sizeof(menu_data)); //reset menu state. Forces reloading of cached variables.
|
||||
menu_data_reset(); //Forces reloading of cached variables.
|
||||
}
|
||||
|
||||
static void lcd_sd_updir()
|
||||
|
@ -7108,7 +7108,7 @@ static void lcd_sd_updir()
|
|||
card.updir();
|
||||
menu_top = 0;
|
||||
lcd_encoder = 0;
|
||||
memset(&menu_data, 0, sizeof(menu_data)); //reset menu state. Forces reloading of cached variables.
|
||||
menu_data_reset(); //Forces reloading of cached variables.
|
||||
}
|
||||
|
||||
void lcd_print_stop()
|
||||
|
@ -8683,7 +8683,7 @@ void menu_action_sddirectory(const char* filename)
|
|||
MYSERIAL.println(dir_names[depth]);
|
||||
card.chdir(filename);
|
||||
lcd_encoder = 0;
|
||||
memset(&menu_data, 0, sizeof(menu_data)); //reset menu state. Forces reloading of cached variables.
|
||||
menu_data_reset(); //Forces reloading of cached variables.
|
||||
}
|
||||
|
||||
/** LCD API **/
|
||||
|
|
Loading…
Add table
Reference in a new issue