Restore the previous model state when performing a nozzle change
Do not force-enable the model if it was previously disabled.
This commit is contained in:
parent
c5ec77a1ce
commit
36575a4f83
|
|
@ -2507,6 +2507,11 @@ static void temp_model_reset_enabled(bool enabled)
|
||||||
temp_model::data.flag_bits.uninitialized = true;
|
temp_model::data.flag_bits.uninitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool temp_model_enabled()
|
||||||
|
{
|
||||||
|
return temp_model::enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void temp_model_set_enabled(bool enabled)
|
void temp_model_set_enabled(bool enabled)
|
||||||
{
|
{
|
||||||
// set the enabled flag
|
// set the enabled flag
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,7 @@ FORCE_INLINE void autotempShutdown(){
|
||||||
void PID_autotune(float temp, int extruder, int ncycles);
|
void PID_autotune(float temp, int extruder, int ncycles);
|
||||||
|
|
||||||
#ifdef TEMP_MODEL
|
#ifdef TEMP_MODEL
|
||||||
|
bool temp_model_enabled(); // return temperature model state
|
||||||
void temp_model_set_enabled(bool enabled);
|
void temp_model_set_enabled(bool enabled);
|
||||||
void temp_model_set_warn_beep(bool enabled);
|
void temp_model_set_warn_beep(bool enabled);
|
||||||
void temp_model_set_params(float C = NAN, float P = NAN, float Ta_corr = NAN, float warn = NAN, float err = NAN);
|
void temp_model_set_params(float C = NAN, float P = NAN, float Ta_corr = NAN, float warn = NAN, float err = NAN);
|
||||||
|
|
|
||||||
|
|
@ -1029,6 +1029,9 @@ void lcd_commands()
|
||||||
{
|
{
|
||||||
if (!blocks_queued() && cmd_buffer_empty() && !saved_printing)
|
if (!blocks_queued() && cmd_buffer_empty() && !saved_printing)
|
||||||
{
|
{
|
||||||
|
#ifdef TEMP_MODEL
|
||||||
|
static bool was_enabled;
|
||||||
|
#endif //TEMP_MODEL
|
||||||
switch(lcd_commands_step)
|
switch(lcd_commands_step)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -1043,7 +1046,7 @@ void lcd_commands()
|
||||||
enquecommand_P(PSTR("G1 X125 Y10 Z150 F1000"));
|
enquecommand_P(PSTR("G1 X125 Y10 Z150 F1000"));
|
||||||
enquecommand_P(PSTR("M109 S280"));
|
enquecommand_P(PSTR("M109 S280"));
|
||||||
#ifdef TEMP_MODEL
|
#ifdef TEMP_MODEL
|
||||||
//enquecommand_P(PSTR("M310 S0"));
|
was_enabled = temp_model_enabled();
|
||||||
temp_model_set_enabled(false);
|
temp_model_set_enabled(false);
|
||||||
#endif //TEMP_MODEL
|
#endif //TEMP_MODEL
|
||||||
lcd_commands_step = 2;
|
lcd_commands_step = 2;
|
||||||
|
|
@ -1057,13 +1060,11 @@ void lcd_commands()
|
||||||
enquecommand_P(PSTR("M84 XY"));
|
enquecommand_P(PSTR("M84 XY"));
|
||||||
lcd_update_enabled = false; //hack to avoid lcd_update recursion.
|
lcd_update_enabled = false; //hack to avoid lcd_update recursion.
|
||||||
if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_NOZZLE_CNG_CHANGED), false) == LCD_LEFT_BUTTON_CHOICE) {
|
if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_NOZZLE_CNG_CHANGED), false) == LCD_LEFT_BUTTON_CHOICE) {
|
||||||
|
setAllTargetHotends(0);
|
||||||
#ifdef TEMP_MODEL
|
#ifdef TEMP_MODEL
|
||||||
//enquecommand_P(PSTR("M310 S1"));
|
temp_model_set_enabled(was_enabled);
|
||||||
temp_model_set_enabled(true);
|
|
||||||
#endif //TEMP_MODEL
|
#endif //TEMP_MODEL
|
||||||
//enquecommand_P(PSTR("M104 S0"));
|
lcd_commands_step = 1;
|
||||||
setTargetHotendSafe(0,0);
|
|
||||||
lcd_commands_step = 1;
|
|
||||||
}
|
}
|
||||||
lcd_update_enabled = true;
|
lcd_update_enabled = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue