Skip to content

Commit

Permalink
Delay Z-Axis on Autoload
Browse files Browse the repository at this point in the history
Delay z-axis movement when the operators hand is close to the printhead.
  • Loading branch information
sarusani committed Aug 22, 2023
1 parent d84e3a9 commit c4409b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 7 additions & 4 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3596,7 +3596,7 @@ static void gcode_M600(const bool automatic, const float x_position, const float
custom_message_type = CustomMsg::Status;
}

void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex){
void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex, bool raise_z_axis = false){
FSensorBlockRunout fsBlockRunout;

prusa_statistics(22);
Expand All @@ -3612,6 +3612,10 @@ void gcode_M701(float fastLoadLength, uint8_t mmuSlotIndex){
current_position[E_AXIS] += fastLoadLength;
plan_buffer_line_curposXYZE(FILAMENTCHANGE_EFEED_FIRST); //fast sequence

if (raise_z_axis) { // backwards compatibility for 3.12 and older FW
raise_z_above(MIN_Z_FOR_LOAD);
}

load_filament_final_feed(); // slow sequence
st_synchronize();

Expand Down Expand Up @@ -8510,13 +8514,12 @@ SERIAL_PROTOCOLPGM("\n\n");

// Z lift. For safety only allow positive values
if (code_seen('Z')) z_target = fabs(code_value());
else raise_z_above(MIN_Z_FOR_LOAD); // backwards compatibility for 3.12 and older FW


// Raise the Z axis
float delta = raise_z(z_target);

// Load filament
gcode_M701(fastLoadLength, mmuSlotIndex);
gcode_M701(fastLoadLength, mmuSlotIndex, !code_seen('Z')); // if no z -> trigger MIN_Z_FOR_LOAD for backwards compatibility on 3.12 and older FW

// Restore Z axis
raise_z(-delta);
Expand Down
3 changes: 0 additions & 3 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1944,7 +1944,6 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
// modified elsewhere and needs to be redrawn in full.

// reset bFilamentWaitingFlag immediately to avoid re-entry from raise_z_above()!
bool once = !bFilamentWaitingFlag;
bFilamentWaitingFlag = true;

// also force-enable lcd_draw_update (might be 0 when called from outside a menu)
Expand All @@ -1961,12 +1960,10 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
case FilamentAction::MmuLoad:
case FilamentAction::MmuLoadingTest:
lcd_puts_P(_i("Preheating to load")); ////MSG_PREHEATING_TO_LOAD c=20
if (once) raise_z_above(MIN_Z_FOR_LOAD);
break;
case FilamentAction::UnLoad:
case FilamentAction::MmuUnLoad:
lcd_puts_P(_i("Preheating to unload")); ////MSG_PREHEATING_TO_UNLOAD c=20
if (once) raise_z_above(MIN_Z_FOR_UNLOAD);
break;
case FilamentAction::MmuEject:
lcd_puts_P(_i("Preheating to eject")); ////MSG_PREHEATING_TO_EJECT c=20
Expand Down

0 comments on commit c4409b8

Please sign in to comment.