Extract duplicate code into function. Saves 4B of flash.

This commit is contained in:
Marek Bel 2019-05-15 16:27:24 +02:00
parent f16bea26e5
commit 1f3877b221
3 changed files with 11 additions and 3 deletions

View File

@ -498,3 +498,4 @@ void M600_wait_for_user(float HotendTempBckp);
void M600_check_state(float nozzle_temp);
void load_filament_final_feed();
void marlin_wait_for_click();
void marlin_rise_z(void);

View File

@ -3123,7 +3123,14 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
}
//! @brief Rise Z if too low to avoid blob/jam before filament loading
//!
//! It doesn't plan_buffer_line(), as it expects plan_buffer_line() to be called after
//! during extruding (loading) filament.
void marlin_rise_z(void)
{
if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30;
}
void gcode_M701()
{
@ -3148,7 +3155,7 @@ void gcode_M701()
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence
st_synchronize();
if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30;
marlin_rise_z();
current_position[E_AXIS] += 30;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence

View File

@ -1367,7 +1367,7 @@ bFilamentAction=false; // NOT in "mmu_load_to_nozzle_
manage_response(true, true, MMU_TCODE_MOVE);
mmu_continue_loading(false);
mmu_extruder = tmp_extruder; //filament change is finished
if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30;
marlin_rise_z();
mmu_load_to_nozzle();
load_filament_final_feed();
st_synchronize();