From d76cea1b645bd542b19f8bcb9c4e0eae2414441b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Wed, 16 Aug 2023 17:42:13 +0000 Subject: [PATCH] G80: make temp_compensation_retracted global --- Firmware/Marlin_main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c9ed755739..d8d022ff94 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -228,6 +228,10 @@ uint8_t newFanSpeed = 0; float retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP; #endif +#ifndef PINDA_THERMISTOR +static bool temp_compensation_retracted = false; +#endif // !PINDA_THERMISTOR + #ifdef PS_DEFAULT_OFF bool powersupply = false; #else @@ -385,7 +389,7 @@ static void gcode_G28(bool home_x_axis, bool home_y_axis, bool home_z_axis); static void gcode_M105(); #ifndef PINDA_THERMISTOR -static bool temp_compensation_start(); +static void temp_compensation_start(); static void temp_compensation_apply(); #endif @@ -2838,10 +2842,9 @@ static void gcode_G80() bool magnet_elimination = (eeprom_read_byte((uint8_t*)EEPROM_MBL_MAGNET_ELIMINATION) > 0); #ifndef PINDA_THERMISTOR - static bool temp_compensation_retracted = false; if (run == false && eeprom_read_byte((uint8_t *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() == true && target_temperature_bed >= 50) { - temp_compensation_retracted = temp_compensation_start(); + temp_compensation_start(); run = true; repeatcommand_front(); // repeat G80 with all its parameters enquecommand_front_P(G28W); @@ -10242,14 +10245,13 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ #endif //HEATBED_ANALYSIS #ifndef PINDA_THERMISTOR -static bool temp_compensation_start() { - bool retracted = false; +static void temp_compensation_start() { custom_message_type = CustomMsg::TempCompPreheat; custom_message_state = PINDA_HEAT_T + 1; lcd_update(2); - if ((int)degHotend(active_extruder) > extrude_min_temp) { + if (!temp_compensation_retracted && (int)degHotend(active_extruder) > extrude_min_temp) { + temp_compensation_retracted = true; current_position[E_AXIS] -= default_retraction; - retracted = true; } plan_buffer_line_curposXYZE(400); @@ -10268,7 +10270,6 @@ static bool temp_compensation_start() { } custom_message_type = CustomMsg::Status; custom_message_state = 0; - return retracted; } static void temp_compensation_apply() {