diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 0d55c184d..0c78258b9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -9990,6 +9990,9 @@ void ThermalStop(bool allow_pause) } else { // We got a hard thermal error and/or there is no print going on. Just stop. lcd_print_stop(); + + // Also prevent further menu entry + menu_set_block(MENU_BLOCK_THERMAL_ERROR); } // Report the status on the serial, switch to a busy state diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 2d5c2c9d1..b4761304f 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -24,7 +24,7 @@ uint8_t menu_data[MENU_DATA_SIZE]; #endif uint8_t menu_depth = 0; -uint8_t menu_block_entering_on_serious_errors = SERIOUS_ERR_NONE; +uint8_t menu_block_mask = MENU_BLOCK_NONE; uint8_t menu_line = 0; uint8_t menu_item = 0; uint8_t menu_row = 0; diff --git a/Firmware/menu.h b/Firmware/menu.h index 54c8a2cbb..b725adbf7 100755 --- a/Firmware/menu.h +++ b/Firmware/menu.h @@ -29,26 +29,23 @@ extern uint8_t menu_data[MENU_DATA_SIZE]; extern uint8_t menu_depth; -//! definition of serious errors possibly blocking the main menu +//! definition of reasons blocking the main menu //! Use them as bit mask, so that the code may set various errors at the same time enum ESeriousErrors { - SERIOUS_ERR_NONE = 0, - SERIOUS_ERR_MINTEMP_HEATER = 0x01, - SERIOUS_ERR_MINTEMP_BED = 0x02 + MENU_BLOCK_NONE = 0, + MENU_BLOCK_THERMAL_ERROR = 0x01, }; // and possibly others in the future. -//! this is a flag for disabling entering the main menu. If this is set -//! to anything != 0, the only the main status screen will be shown on the -//! LCD and the user will be prevented from entering the menu. -//! Now used only to block doing anything with the printer when there is -//! the infamous MINTEMP error (SERIOUS_ERR_MINTEMP). -extern uint8_t menu_block_entering_on_serious_errors; +//! this is a flag for disabling entering the main menu and longpress. If this is set to anything != +//! 0, the only the main status screen will be shown on the LCD and the user will be prevented from +//! entering the menu. +extern uint8_t menu_block_mask; -//! a pair of macros for manipulating the serious errors +//! a pair of macros for manipulating menu entry //! a c++ class would have been better -#define menu_set_serious_error(x) menu_block_entering_on_serious_errors |= x; -#define menu_unset_serious_error(x) menu_block_entering_on_serious_errors &= ~x; -#define menu_is_serious_error(x) (menu_block_entering_on_serious_errors & x) != 0 +#define menu_set_block(x) menu_block_mask |= x; +#define menu_unset_block(x) menu_block_mask &= ~x; +#define menu_is_blocked(x) (menu_block_mask & x) != 0 extern uint8_t menu_line; extern uint8_t menu_item; diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index bf8c2bb21..b976acbc4 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -1700,7 +1700,6 @@ void handle_temp_error() switch((TempErrorSource)temp_error_state.source) { case TempErrorSource::hotend: if(temp_error_state.assert) { - menu_set_serious_error(SERIOUS_ERR_MINTEMP_HEATER); min_temp_error(temp_error_state.index); } else { // no recovery, just force the user to restart the printer @@ -1714,7 +1713,6 @@ void handle_temp_error() break; case TempErrorSource::bed: if(temp_error_state.assert) { - menu_set_serious_error(SERIOUS_ERR_MINTEMP_BED); bed_min_temp_error(); } else { // no recovery, just force the user to restart the printer @@ -1772,6 +1770,7 @@ void handle_temp_error() } else { temp_error_state.v = 0; WRITE(BEEPER, LOW); + menu_unset_block(MENU_BLOCK_THERMAL_ERROR); SERIAL_ECHOLNPGM("TM: error cleared"); } break; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index e23a67b26..f9c420554 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -863,7 +863,7 @@ void lcd_status_screen() // NOT static due to using ins } if (current_click - && ( menu_block_entering_on_serious_errors == SERIOUS_ERR_NONE ) // or a serious error blocks entering the menu + && ( menu_block_mask == MENU_BLOCK_NONE ) // or a serious error blocks entering the menu ) { menu_depth = 0; //redundant, as already done in lcd_return_to_status(), just to be sure @@ -8076,7 +8076,7 @@ uint8_t get_message_level() void menu_lcd_longpress_func(void) { backlight_wake(); - if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z || menu_block_entering_on_serious_errors != SERIOUS_ERR_NONE) + if (homing_flag || mesh_bed_leveling_flag || menu_menu == lcd_babystep_z || menu_menu == lcd_move_z || menu_block_mask != MENU_BLOCK_NONE) { // disable longpress during re-entry, while homing, calibration or if a serious error lcd_quick_feedback();