From 61ec6b8ae7148b6df122f29f41d373201f1ee3b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Wed, 16 Aug 2023 16:34:20 +0000 Subject: [PATCH] G80: Don't unretract unless retracting first temp_compensation_start() is only called when PINDA_THERMISTOR is not defined. Additionally make sure the retraction or unretraction cannot happen twice in case MBL fails. For MK3S users with MMU this extrusion move could cause a FINDA runout event. Change in memory: Flash: -130 bytes SRAM: 0 bytes --- Firmware/Marlin_main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c08cc3d2e..b5aecef75 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 @@ -3159,11 +3163,14 @@ static void gcode_G80() // SERIAL_ECHOLNPGM("Mesh bed leveling activated"); go_home_with_z_lift(); // SERIAL_ECHOLNPGM("Go home finished"); +#ifndef PINDA_THERMISTOR //unretract (after PINDA preheat retraction) - if (((int)degHotend(active_extruder) > extrude_min_temp) && eeprom_read_byte((unsigned char *)EEPROM_TEMP_CAL_ACTIVE) && calibration_status_pinda() && (target_temperature_bed >= 50)) { + if (temp_compensation_retracted) { + temp_compensation_retracted = false; current_position[E_AXIS] += default_retraction; plan_buffer_line_curposXYZE(400); } +#endif // !PINDA_THERMISTOR KEEPALIVE_STATE(NOT_BUSY); // Restore custom message state lcd_setstatuspgm(MSG_WELCOME); @@ -10237,11 +10244,11 @@ void bed_analysis(float x_dimension, float y_dimension, int x_points_num, int y_ #ifndef PINDA_THERMISTOR 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; } plan_buffer_line_curposXYZE(400);