Merge pull request #4403 from gudnimg/PFW-1542

PFW-1542 Fix an issue where print can't be stopped under specific circumstances
This commit is contained in:
3d-gussner 2023-09-25 10:43:18 +02:00 committed by GitHub
commit c97143fc2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 26 deletions

View File

@ -99,7 +99,6 @@ static void lcd_language_menu();
static void lcd_main_menu(); static void lcd_main_menu();
static void lcd_tune_menu(); static void lcd_tune_menu();
static void lcd_settings_menu(); static void lcd_settings_menu();
static void lcd_calibration_menu();
static void lcd_control_temperature_menu(); static void lcd_control_temperature_menu();
#ifdef TMC2130 #ifdef TMC2130
static void lcd_settings_linearity_correction_menu_save(); static void lcd_settings_linearity_correction_menu_save();
@ -4555,8 +4554,6 @@ static void lcd_calibration_menu()
{ {
MENU_BEGIN(); MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_BACK_P(_T(MSG_MAIN));
if (!isPrintPaused)
{
MENU_ITEM_FUNCTION_P(_i("Wizard"), lcd_wizard);////MSG_WIZARD c=17 MENU_ITEM_FUNCTION_P(_i("Wizard"), lcd_wizard);////MSG_WIZARD c=17
if (lcd_commands_type == LcdCommands::Idle) if (lcd_commands_type == LcdCommands::Idle)
{ {
@ -4584,7 +4581,7 @@ static void lcd_calibration_menu()
if(has_temperature_compensation()) if(has_temperature_compensation())
MENU_ITEM_FUNCTION_P(_T(MSG_PINDA_CALIBRATION), lcd_calibrate_pinda); MENU_ITEM_FUNCTION_P(_T(MSG_PINDA_CALIBRATION), lcd_calibrate_pinda);
#endif #endif
}
#ifdef THERMAL_MODEL #ifdef THERMAL_MODEL
MENU_ITEM_SUBMENU_P(_n("Thermal Model cal."), lcd_thermal_model_cal); MENU_ITEM_SUBMENU_P(_n("Thermal Model cal."), lcd_thermal_model_cal);
#endif //THERMAL_MODEL #endif //THERMAL_MODEL
@ -5009,7 +5006,6 @@ void lcd_resume_print()
lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS));
st_synchronize(); st_synchronize();
custom_message_type = CustomMsg::Resuming; custom_message_type = CustomMsg::Resuming;
isPrintPaused = false;
// resume processing USB commands again and restore hotend fan state (in case the print was // resume processing USB commands again and restore hotend fan state (in case the print was
// stopped due to a thermal error) // stopped due to a thermal error)
@ -5017,6 +5013,7 @@ void lcd_resume_print()
Stopped = false; Stopped = false;
restore_print_from_ram_and_continue(default_retraction); restore_print_from_ram_and_continue(default_retraction);
isPrintPaused = false;
pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation pause_time += (_millis() - start_pause_print); //accumulate time when print is paused for correct statistics calculation
refresh_cmd_timeout(); refresh_cmd_timeout();
SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUMED); //resume octoprint
@ -5253,17 +5250,15 @@ static void lcd_main_menu()
} }
#endif //SDSUPPORT #endif //SDSUPPORT
if(!isPrintPaused && !printJobOngoing() && (lcd_commands_type == LcdCommands::Idle)) { if(!printer_active() && !farm_mode) {
if (!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) && (sheet != nextSheet)) { // show menu only if we have 2 or more sheets initialized if ((nextSheet >= 0) && (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);
} }
} }
}
if ( ! ( printJobOngoing() || (lcd_commands_type != LcdCommands::Idle) || (eFilamentAction != FilamentAction::None) || Stopped ) ) { if ( ! ( printer_active() || (eFilamentAction != FilamentAction::None) || Stopped ) ) {
if (MMU2::mmu2.Enabled()) { if (MMU2::mmu2.Enabled()) {
if(!MMU2::mmu2.FindaDetectsFilament() && !fsensor.getFilamentPresent()) { if(!MMU2::mmu2.FindaDetectsFilament() && !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
@ -5291,7 +5286,7 @@ static void lcd_main_menu()
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament);
} }
MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu);
if(!isPrintPaused && (custom_message_type != CustomMsg::Resuming)) MENU_ITEM_SUBMENU_P(_T(MSG_CALIBRATION), lcd_calibration_menu); if(!isPrintPaused) MENU_ITEM_SUBMENU_P(_T(MSG_CALIBRATION), lcd_calibration_menu);
} }
if (!usb_timer.running()) { if (!usb_timer.running()) {