diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index cec4ad91..df191ca3 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2509,6 +2509,11 @@ static void temp_model_reset_enabled(bool enabled) temp_model::data.flag_bits.uninitialized = true; } +bool temp_model_enabled() +{ + return temp_model::enabled; +} + void temp_model_set_enabled(bool enabled) { // set the enabled flag diff --git a/Firmware/temperature.h b/Firmware/temperature.h index c6c52227..03629db1 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -217,6 +217,7 @@ FORCE_INLINE void autotempShutdown(){ void PID_autotune(float temp, int extruder, int ncycles); #ifdef TEMP_MODEL +bool temp_model_enabled(); // return temperature model state void temp_model_set_enabled(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); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c8d757d8..97d908a8 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1085,6 +1085,9 @@ void lcd_commands() { if (!blocks_queued() && cmd_buffer_empty() && !saved_printing) { +#ifdef TEMP_MODEL + static bool was_enabled; +#endif //TEMP_MODEL switch(lcd_commands_step) { case 0: @@ -1099,7 +1102,7 @@ void lcd_commands() enquecommand_P(PSTR("G1 X125 Y10 Z150 F1000")); enquecommand_P(PSTR("M109 S280")); #ifdef TEMP_MODEL - //enquecommand_P(PSTR("M310 S0")); + was_enabled = temp_model_enabled(); temp_model_set_enabled(false); #endif //TEMP_MODEL lcd_commands_step = 2; @@ -1113,13 +1116,11 @@ void lcd_commands() enquecommand_P(PSTR("M84 XY")); 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, true)) { + setAllTargetHotends(0); #ifdef TEMP_MODEL - //enquecommand_P(PSTR("M310 S1")); - temp_model_set_enabled(true); + temp_model_set_enabled(was_enabled); #endif //TEMP_MODEL - //enquecommand_P(PSTR("M104 S0")); - setTargetHotendSafe(0,0); - lcd_commands_step = 1; + lcd_commands_step = 1; } lcd_update_enabled = true; break;