Apply the RAII in more places
Change in memory: Flash: -80 bytes SRAM: 0 bytes
This commit is contained in:
parent
452cb23a03
commit
0ad92de837
|
|
@ -282,9 +282,8 @@ static void menu_item_sddir(const char* str_fn, char* str_fnl)
|
|||
}
|
||||
if (menu_clicked && (lcd_encoder == menu_item))
|
||||
{
|
||||
lcd_update_enabled = false;
|
||||
LCDUpdateEnableRAII();
|
||||
menu_action_sddirectory(str_fn);
|
||||
lcd_update_enabled = true;
|
||||
menu_item_ret();
|
||||
return;
|
||||
}
|
||||
|
|
@ -299,9 +298,8 @@ static void menu_item_sdfile(const char* str_fn, char* str_fnl)
|
|||
}
|
||||
if (menu_clicked && (lcd_encoder == menu_item))
|
||||
{
|
||||
lcd_update_enabled = false;
|
||||
LCDUpdateEnableRAII();
|
||||
menu_action_sdfile(str_fn);
|
||||
lcd_update_enabled = true;
|
||||
menu_item_ret();
|
||||
return;
|
||||
}
|
||||
|
|
@ -966,9 +964,10 @@ void lcd_commands()
|
|||
lcd_commands_step = 3;
|
||||
break;
|
||||
case 3:
|
||||
lcd_update_enabled = false; //hack to avoid lcd_update recursion.
|
||||
lcd_show_fullscreen_message_and_wait_P(_T(MSG_NOZZLE_CNG_READ_HELP));
|
||||
lcd_update_enabled = true;
|
||||
{
|
||||
LCDUpdateEnableRAII(); //hack to avoid lcd_update recursion.
|
||||
lcd_show_fullscreen_message_and_wait_P(_T(MSG_NOZZLE_CNG_READ_HELP));
|
||||
}
|
||||
lcd_draw_update = 2; //force lcd clear and update after the stack unwinds.
|
||||
enquecommand_P(G28W);
|
||||
enquecommand_P(PSTR("G1 X125 Z200 F1000"));
|
||||
|
|
@ -986,7 +985,7 @@ void lcd_commands()
|
|||
//|tightend to specs?
|
||||
//| Yes No
|
||||
enquecommand_P(PSTR("M84 XY"));
|
||||
lcd_update_enabled = false; //hack to avoid lcd_update recursion.
|
||||
LCDUpdateEnableRAII(); //hack to avoid lcd_update recursion.
|
||||
if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_NOZZLE_CNG_CHANGED), false) == LCD_LEFT_BUTTON_CHOICE) {
|
||||
setTargetHotend(0);
|
||||
#ifdef THERMAL_MODEL
|
||||
|
|
@ -994,7 +993,6 @@ void lcd_commands()
|
|||
#endif //THERMAL_MODEL
|
||||
lcd_commands_step = 1;
|
||||
}
|
||||
lcd_update_enabled = true;
|
||||
break;
|
||||
case 1:
|
||||
lcd_setstatuspgm(MSG_WELCOME);
|
||||
|
|
@ -2942,7 +2940,7 @@ const char* lcd_display_message_fullscreen_P(const char *msg)
|
|||
*/
|
||||
void lcd_show_fullscreen_message_and_wait_P(const char *msg)
|
||||
{
|
||||
LCDUpdateEnableRAII lcdUpdateDisabler;
|
||||
LCDUpdateEnableRAII();
|
||||
const char *msg_next = lcd_display_message_fullscreen_P(msg);
|
||||
bool multi_screen = msg_next != NULL;
|
||||
lcd_consume_click();
|
||||
|
|
@ -3607,11 +3605,12 @@ void lcd_v2_calibration() {
|
|||
if (fsensor.isReady()) {
|
||||
loaded = fsensor.getFilamentPresent();
|
||||
} else {
|
||||
LCDUpdateEnableRAII();
|
||||
loaded = !lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_FILAMENT_LOADED), false, LCD_MIDDLE_BUTTON_CHOICE);
|
||||
lcd_update_enabled = true;
|
||||
}
|
||||
|
||||
if (!loaded) {
|
||||
LCDUpdateEnableRAII();
|
||||
lcd_display_message_fullscreen_P(_i("Please load filament first."));////MSG_PLEASE_LOAD_PLA c=20 r=4
|
||||
lcd_consume_click();
|
||||
for (uint_least8_t i = 0; i < 20; i++) { //wait max. 2s
|
||||
|
|
@ -3620,7 +3619,6 @@ void lcd_v2_calibration() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
lcd_update_enabled = true;
|
||||
menu_back();
|
||||
return;
|
||||
}
|
||||
|
|
@ -5734,9 +5732,10 @@ void lcd_sdcard_menu()
|
|||
if (card.presort_flag == true) //used to force resorting if sorting type is changed.
|
||||
{
|
||||
card.presort_flag = false;
|
||||
lcd_update_enabled = false;
|
||||
card.presort();
|
||||
lcd_update_enabled = true;
|
||||
{
|
||||
LCDUpdateEnableRAII();
|
||||
card.presort();
|
||||
}
|
||||
}
|
||||
_md->fileCnt = card.getnrfilenames();
|
||||
_md->sdSort = farm_mode ? SD_SORT_NONE : eeprom_read_byte((uint8_t*)EEPROM_SD_SORT);
|
||||
|
|
|
|||
Loading…
Reference in New Issue