Skip to content

Commit

Permalink
G80: Don't unretract unless retracting first
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gudnimg committed Aug 16, 2023
1 parent 0e469c0 commit 43c530d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 43c530d

Please sign in to comment.