Refuse to run TM calibration if the printer is not idle

This commit is contained in:
Yuri D'Elia 2022-06-27 12:25:38 +02:00
parent 9c971b1b89
commit ea0840dee9
3 changed files with 11 additions and 1 deletions

View File

@ -358,6 +358,8 @@ 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();
//! 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
//! There can be a considerable lag between posting M600 and its real processing which might result

View File

@ -572,6 +572,10 @@ void servo_init()
#endif
}
bool printer_active()
{
return PRINTER_ACTIVE;
}
bool fans_check_enabled = true;

View File

@ -2838,7 +2838,11 @@ bool autotune(int16_t cal_temp)
void temp_model_autotune(int16_t temp)
{
// TODO: ensure printer is idle/queue empty/buffer empty
if(moves_planned() || printer_active()) {
SERIAL_ECHOLNPGM("TM: printer needs to be idle for calibration");
return;
}
KEEPALIVE_STATE(IN_PROCESS);
// disable the model checking during self-calibration