diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index 87b2f98b..12b48782 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -355,7 +355,6 @@ extern uint16_t gcode_in_progress; extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || usb_timer.running() || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || mmu_print_saved || homing_flag || mesh_bed_leveling_flag) extern bool printer_active(); diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 680753f0..2139bb51 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -562,9 +562,16 @@ void servo_init() #endif } -bool printer_active() -{ - return PRINTER_ACTIVE; +bool __attribute__((noinline)) printer_active() { + return IS_SD_PRINTING + || usb_timer.running() + || isPrintPaused + || (custom_message_type == CustomMsg::TempCal) + || saved_printing + || (lcd_commands_type == LcdCommands::Layer1Cal) + || mmu_print_saved + || homing_flag + || mesh_bed_leveling_flag; } bool fans_check_enabled = true; @@ -9373,7 +9380,7 @@ static void handleSafetyTimer() #if (EXTRUDERS > 1) #error Implemented only for one extruder. #endif //(EXTRUDERS > 1) - if ((PRINTER_ACTIVE) || (!degTargetBed() && !degTargetHotend(0)) || (!safetytimer_inactive_time)) + if (printer_active() || (!degTargetBed() && !degTargetHotend(0)) || (!safetytimer_inactive_time)) { safetyTimer.stop(); } @@ -9427,7 +9434,7 @@ static uint16_t nFSCheckCount=0; if (mmu_enabled == false) { //-// if (mcode_in_progress != 600) //M600 not in progress - if (!PRINTER_ACTIVE) bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); //Block Filament sensor actions if PRINTER is not active and Support::SensorInfo menu active + if (!printer_active()) bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); //Block Filament sensor actions if PRINTER is not active and Support::SensorInfo menu active #ifdef IR_SENSOR_ANALOG bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Block Filament sensor actions if Settings::HWsetup::FSdetect menu active #endif // IR_SENSOR_ANALOG @@ -10933,7 +10940,7 @@ ISR(INT4_vect) { EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once SERIAL_ECHOLNPGM("INT4"); //fire normal uvlo only in case where EEPROM_UVLO is 0 or if IS_SD_PRINTING is 1. - if(PRINTER_ACTIVE && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); + if(printer_active() && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))) uvlo_(); if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny(); } diff --git a/Firmware/fancheck.cpp b/Firmware/fancheck.cpp index 421216f3..86797bbc 100755 --- a/Firmware/fancheck.cpp +++ b/Firmware/fancheck.cpp @@ -137,7 +137,7 @@ void checkFanSpeed() // we may even send some info to the LCD from here fan_check_error = EFCE_FIXED; } - if ((fan_check_error == EFCE_FIXED) && !PRINTER_ACTIVE){ + if ((fan_check_error == EFCE_FIXED) && !printer_active()){ fan_check_error = EFCE_OK; //if the issue is fixed while the printer is doing nothing, reenable processing immediately. lcd_reset_alert_level(); //for another fan speed error } diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7d755396..da44bcab 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -436,7 +436,7 @@ void lcdui_print_percent_done(void) { const char* src = usb_timer.running()?_N("USB"):(IS_SD_PRINTING?_N(" SD"):_N(" ")); char per[4]; - bool num = IS_SD_PRINTING || (PRINTER_ACTIVE && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT)); + bool num = IS_SD_PRINTING || (printer_active() && (print_percent_done_normal != PRINT_PERCENT_DONE_INIT)); if (!num || heating_status != HeatingStatus::NO_HEATING) // either not printing or heating { const int8_t sheetNR = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); @@ -492,7 +492,7 @@ void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time int chars = 0; - if (PRINTER_ACTIVE) { + if (printer_active()) { uint16_t print_t = PRINT_TIME_REMAINING_INIT; uint16_t print_tr = PRINT_TIME_REMAINING_INIT; uint16_t print_tc = PRINT_TIME_REMAINING_INIT; @@ -4805,7 +4805,7 @@ static void lcd_settings_menu() MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE c=18 - if (!PRINTER_ACTIVE || isPrintPaused) + if (!printer_active() || isPrintPaused) { MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_axis);////MSG_MOVE_AXIS c=18 MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=18 @@ -5505,7 +5505,7 @@ static void lcd_main_menu() if (farm_mode) MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - if ( moves_planned() || PRINTER_ACTIVE ) { + if ( moves_planned() || printer_active() ) { MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE c=18 } else { MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT c=18