Revert split if statements

Kept few as these get too long
This commit is contained in:
3d-gussner 2024-03-27 10:15:07 +01:00
parent 5f26d5f7da
commit 9e8aadd8af
1 changed files with 16 additions and 39 deletions

View File

@ -5238,30 +5238,23 @@ static void lcd_main_menu()
#endif //TMC2130_DEBUG #endif //TMC2130_DEBUG
// Menu item for reprint // Menu item for reprint
if (!printer_active() if (!printer_active() && !printer_recovering() && (heating_status == HeatingStatus::NO_HEATING)) {
&& !printer_recovering() if ((GetPrinterState() == PrinterState::SDPrintingFinished) && card.mounted) {
&& (heating_status == HeatingStatus::NO_HEATING)) {
if ((GetPrinterState() == PrinterState::SDPrintingFinished)
&& card.mounted) {
MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_reprint_from_eeprom); MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_reprint_from_eeprom);
} else if ((GetPrinterState() == PrinterState::HostPrintingFinished) } else if ((GetPrinterState() == PrinterState::HostPrintingFinished) && M79_timer_get_status()) {
&& M79_timer_get_status()) {
MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_send_action_start); MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_send_action_start);
} }
} }
// Menu is never shown when idle // Menu is never shown when idle
if (babystep_allowed_strict() if (babystep_allowed_strict() && (printJobOngoing() || lcd_commands_type == LcdCommands::Layer1Cal))
&& (printJobOngoing()
|| lcd_commands_type == LcdCommands::Layer1Cal))
MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8
if (farm_mode) if (farm_mode)
MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8
if (!printer_recovering()) { if (!printer_recovering()) {
if ( moves_planned() if ( moves_planned() || printer_active()) {
|| printer_active()) {
MENU_ITEM_SUBMENU_P(_T(MSG_TUNE), lcd_tune_menu); MENU_ITEM_SUBMENU_P(_T(MSG_TUNE), lcd_tune_menu);
} else if (!Stopped) { } else if (!Stopped) {
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT c=18 MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT c=18
@ -5273,10 +5266,7 @@ static void lcd_main_menu()
} }
} }
} }
if (mesh_bed_leveling_flag == false if (mesh_bed_leveling_flag == false && homing_flag == false && !printingIsPaused() && !processing_tcode) {
&& homing_flag == false
&& !printingIsPaused()
&& !processing_tcode) {
if (usb_timer.running()) { if (usb_timer.running()) {
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print); MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);
} else if (IS_SD_PRINTING) { } else if (IS_SD_PRINTING) {
@ -5290,21 +5280,16 @@ static void lcd_main_menu()
#ifdef FANCHECK #ifdef FANCHECK
&& fan_check_error != EFCE_REPORTED && fan_check_error != EFCE_REPORTED
#endif //FANCHECK #endif //FANCHECK
&& (saved_printing_type != PowerPanic::PRINT_TYPE_NONE && (saved_printing_type != PowerPanic::PRINT_TYPE_NONE || saved_printing)
|| saved_printing)
&& custom_message_type != CustomMsg::Resuming) { && custom_message_type != CustomMsg::Resuming) {
if (saved_printing_type == PowerPanic::PRINT_TYPE_SD) { if (saved_printing_type == PowerPanic::PRINT_TYPE_SD) {
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print); MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);
} else if ((saved_printing_type == PowerPanic::PRINT_TYPE_HOST) } else if ((saved_printing_type == PowerPanic::PRINT_TYPE_HOST) && (M79_timer_get_status())) {
&& (M79_timer_get_status())) {
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print); MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);
} }
} }
if((printJobOngoing() if((printJobOngoing() || printingIsPaused() || (printer_recovering()))
|| printingIsPaused() && (custom_message_type != CustomMsg::MeshBedLeveling) && !processing_tcode) {
|| (printer_recovering()))
&& (custom_message_type != CustomMsg::MeshBedLeveling)
&& !processing_tcode) {
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
} }
#ifdef THERMAL_MODEL #ifdef THERMAL_MODEL
@ -5314,9 +5299,7 @@ static void lcd_main_menu()
#endif #endif
// only allow starting SD print if hardware errors (temperature or fan) are cleared // only allow starting SD print if hardware errors (temperature or fan) are cleared
if (!printer_recovering() if (!printer_recovering() && !printer_active() && !get_temp_error()
&& !printer_active()
&& !get_temp_error()
#ifdef FANCHECK #ifdef FANCHECK
&& fan_check_error != EFCE_REPORTED && fan_check_error != EFCE_REPORTED
#endif //FANCHECK #endif //FANCHECK
@ -5325,8 +5308,7 @@ static void lcd_main_menu()
if (card.mounted if (card.mounted
|| lcd_commands_type != LcdCommands::Idle) { || lcd_commands_type != LcdCommands::Idle) {
if (!card.isFileOpen()) { if (!card.isFileOpen()) {
if (!usb_timer.running() if (!usb_timer.running() && (lcd_commands_type == LcdCommands::Idle)) {
&& (lcd_commands_type == LcdCommands::Idle)) {
bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function
MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu);
} }
@ -5342,12 +5324,10 @@ static void lcd_main_menu()
#endif //SDCARDDETECT #endif //SDCARDDETECT
} }
#endif //SDSUPPORT #endif //SDSUPPORT
if(!printer_active() if(!printer_active() && !farm_mode) {
&& !farm_mode) {
const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
const int8_t nextSheet = eeprom_next_initialized_sheet(sheet); const int8_t nextSheet = eeprom_next_initialized_sheet(sheet);
if ((nextSheet >= 0) if ((nextSheet >= 0) && (sheet != nextSheet)) { // show menu only if we have 2 or more sheets initialized
&& (sheet != nextSheet)) { // show menu only if we have 2 or more sheets initialized
MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet); MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet);
} }
#ifdef QUICK_NOZZLE_CHANGE #ifdef QUICK_NOZZLE_CHANGE
@ -5356,12 +5336,9 @@ static void lcd_main_menu()
} }
if (!( printer_active() if (!( printer_active() || (eFilamentAction != FilamentAction::None) || Stopped )) {
|| (eFilamentAction != FilamentAction::None)
|| Stopped )) {
if (MMU2::mmu2.Enabled()) { if (MMU2::mmu2.Enabled()) {
if(!MMU2::mmu2.FindaDetectsFilament() if(!MMU2::mmu2.FindaDetectsFilament() && !fsensor.getFilamentPresent()) {
&& !fsensor.getFilamentPresent()) {
// The MMU 'Load filament' state machine will reject the command if any // The MMU 'Load filament' state machine will reject the command if any
// filament sensor is reporting a detected filament // filament sensor is reporting a detected filament
MENU_ITEM_SUBMENU_P(_T(MSG_PRELOAD_TO_MMU), mmu_preload_filament_menu); MENU_ITEM_SUBMENU_P(_T(MSG_PRELOAD_TO_MMU), mmu_preload_filament_menu);