Implement printJobOngoing()
This makes the if statments a little bit more readable Change in memory: Flash: -88 bytes SRAM: 0 bytes
This commit is contained in:
parent
561d8599d2
commit
e40d8ebbcc
|
|
@ -113,8 +113,7 @@ void Filament_sensor::triggerFilamentInserted() {
|
||||||
&& (! MMU2::mmu2.Enabled() ) // quick and dirty hack to prevent spurious runouts while the MMU is in charge
|
&& (! MMU2::mmu2.Enabled() ) // quick and dirty hack to prevent spurious runouts while the MMU is in charge
|
||||||
&& !(
|
&& !(
|
||||||
moves_planned() != 0
|
moves_planned() != 0
|
||||||
|| IS_SD_PRINTING
|
|| printJobOngoing()
|
||||||
|| usb_timer.running()
|
|
||||||
|| (lcd_commands_type == LcdCommands::Layer1Cal)
|
|| (lcd_commands_type == LcdCommands::Layer1Cal)
|
||||||
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
|
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
|
||||||
)
|
)
|
||||||
|
|
@ -131,8 +130,7 @@ void Filament_sensor::triggerFilamentRemoved() {
|
||||||
&& !saved_printing
|
&& !saved_printing
|
||||||
&& (
|
&& (
|
||||||
moves_planned() != 0
|
moves_planned() != 0
|
||||||
|| IS_SD_PRINTING
|
|| printJobOngoing()
|
||||||
|| usb_timer.running()
|
|
||||||
|| (lcd_commands_type == LcdCommands::Layer1Cal)
|
|| (lcd_commands_type == LcdCommands::Layer1Cal)
|
||||||
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
|
|| eeprom_read_byte((uint8_t *)EEPROM_WIZARD_ACTIVE)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,11 @@ extern LongTimer safetyTimer;
|
||||||
|
|
||||||
#define PRINT_PERCENT_DONE_INIT 0xff
|
#define PRINT_PERCENT_DONE_INIT 0xff
|
||||||
|
|
||||||
extern bool printer_active();
|
// Returns true if there is a print running. It does not matter if
|
||||||
|
// the print is paused, that still counts as a "running" print.
|
||||||
|
bool printJobOngoing();
|
||||||
|
|
||||||
|
bool printer_active();
|
||||||
|
|
||||||
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
|
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
|
||||||
//! which is not the same as posting the M600 command into the command queue
|
//! which is not the same as posting the M600 command into the command queue
|
||||||
|
|
|
||||||
|
|
@ -525,9 +525,12 @@ void servo_init()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool __attribute__((noinline)) printJobOngoing() {
|
||||||
|
return (IS_SD_PRINTING || usb_timer.running());
|
||||||
|
}
|
||||||
|
|
||||||
bool __attribute__((noinline)) printer_active() {
|
bool __attribute__((noinline)) printer_active() {
|
||||||
return IS_SD_PRINTING
|
return printJobOngoing()
|
||||||
|| usb_timer.running()
|
|
||||||
|| isPrintPaused
|
|| isPrintPaused
|
||||||
|| (custom_message_type == CustomMsg::TempCal)
|
|| (custom_message_type == CustomMsg::TempCal)
|
||||||
|| saved_printing
|
|| saved_printing
|
||||||
|
|
@ -539,7 +542,7 @@ bool __attribute__((noinline)) printer_active() {
|
||||||
|
|
||||||
// Currently only used in one place, allowed to be inlined
|
// Currently only used in one place, allowed to be inlined
|
||||||
bool check_fsensor() {
|
bool check_fsensor() {
|
||||||
return (IS_SD_PRINTING || usb_timer.running())
|
return printJobOngoing()
|
||||||
&& mcode_in_progress != 600
|
&& mcode_in_progress != 600
|
||||||
&& !saved_printing
|
&& !saved_printing
|
||||||
&& e_active();
|
&& e_active();
|
||||||
|
|
@ -548,7 +551,7 @@ bool check_fsensor() {
|
||||||
bool __attribute__((noinline)) babystep_allowed() {
|
bool __attribute__((noinline)) babystep_allowed() {
|
||||||
return ( (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU)
|
return ( (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU)
|
||||||
&& !homing_flag && !mesh_bed_leveling_flag
|
&& !homing_flag && !mesh_bed_leveling_flag
|
||||||
&& ( blocks_queued() || lcd_commands_type == LcdCommands::Layer1Cal || ( !isPrintPaused && (IS_SD_PRINTING || usb_timer.running()) ))
|
&& ( blocks_queued() || lcd_commands_type == LcdCommands::Layer1Cal || ( !isPrintPaused && printJobOngoing() ))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9574,7 +9577,7 @@ void ThermalStop(bool allow_recovery)
|
||||||
Stopped = true;
|
Stopped = true;
|
||||||
|
|
||||||
// Either pause or stop the print
|
// Either pause or stop the print
|
||||||
if(allow_recovery && (IS_SD_PRINTING || usb_timer.running())) {
|
if(allow_recovery && printJobOngoing()) {
|
||||||
if (!isPrintPaused) {
|
if (!isPrintPaused) {
|
||||||
lcd_setalertstatuspgm(_T(MSG_PAUSED_THERMAL_ERROR), LCD_STATUS_CRITICAL);
|
lcd_setalertstatuspgm(_T(MSG_PAUSED_THERMAL_ERROR), LCD_STATUS_CRITICAL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ void fanSpeedError(unsigned char _fan) {
|
||||||
if (fan_check_error == EFCE_REPORTED) return;
|
if (fan_check_error == EFCE_REPORTED) return;
|
||||||
fan_check_error = EFCE_REPORTED;
|
fan_check_error = EFCE_REPORTED;
|
||||||
|
|
||||||
if (IS_SD_PRINTING || usb_timer.running()) {
|
if (printJobOngoing()) {
|
||||||
// A print is ongoing, pause the print normally
|
// A print is ongoing, pause the print normally
|
||||||
if(!isPrintPaused) {
|
if(!isPrintPaused) {
|
||||||
if (usb_timer.running())
|
if (usb_timer.running())
|
||||||
|
|
|
||||||
|
|
@ -3495,7 +3495,7 @@ static void crash_mode_switch()
|
||||||
{
|
{
|
||||||
lcd_crash_detect_enable();
|
lcd_crash_detect_enable();
|
||||||
}
|
}
|
||||||
if (IS_SD_PRINTING || usb_timer.running() || (lcd_commands_type == LcdCommands::Layer1Cal)) menu_goto(lcd_tune_menu, 9, true, true);
|
if (printJobOngoing() || (lcd_commands_type == LcdCommands::Layer1Cal)) menu_goto(lcd_tune_menu, 9, true, true);
|
||||||
else menu_goto(lcd_settings_menu, 9, true, true);
|
else menu_goto(lcd_settings_menu, 9, true, true);
|
||||||
}
|
}
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
@ -5371,7 +5371,7 @@ static void lcd_main_menu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((IS_SD_PRINTING || usb_timer.running() || isPrintPaused) && (custom_message_type != CustomMsg::MeshBedLeveling) && !processing_tcode) {
|
if((printJobOngoing() || isPrintPaused) && (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 TEMP_MODEL
|
#ifdef TEMP_MODEL
|
||||||
|
|
@ -5399,7 +5399,7 @@ static void lcd_main_menu()
|
||||||
}
|
}
|
||||||
#endif //SDSUPPORT
|
#endif //SDSUPPORT
|
||||||
|
|
||||||
if(!isPrintPaused && !IS_SD_PRINTING && !usb_timer.running() && (lcd_commands_type != LcdCommands::Layer1Cal)) {
|
if(!isPrintPaused && !printJobOngoing() && (lcd_commands_type != LcdCommands::Layer1Cal)) {
|
||||||
if (!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);
|
||||||
|
|
@ -5409,7 +5409,7 @@ static void lcd_main_menu()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! ( IS_SD_PRINTING || usb_timer.running() || (lcd_commands_type == LcdCommands::Layer1Cal || Stopped) ) ) {
|
if ( ! ( printJobOngoing() || (lcd_commands_type == LcdCommands::Layer1Cal || Stopped) ) ) {
|
||||||
if (MMU2::mmu2.Enabled()) {
|
if (MMU2::mmu2.Enabled()) {
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), mmu_load_filament_menu);
|
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), mmu_load_filament_menu);
|
||||||
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu);////MSG_LOAD_TO_NOZZLE c=18
|
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu);////MSG_LOAD_TO_NOZZLE c=18
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue