PFW-1386 Implement 'U' parameter for M702

Similar to 'L' in M701, this does not apply to the MMU
The U parameter controls how much mm the extruder will unload
Default value is 80mm
This commit is contained in:
Guðni Már Gilbert 2022-08-27 15:48:31 +00:00 committed by D.R.racer
parent 7e9166976f
commit 20c865c2d4
3 changed files with 13 additions and 19 deletions

View File

@ -3592,7 +3592,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float
if (MMU2::mmu2.Enabled())
mmu_M600_unload_filament();
else
unload_filament(true); // unload filament for single material (used also in M702)
unload_filament(FILAMENTCHANGE_FINALRETRACT, true); // unload filament for single material (used also in M702)
st_synchronize(); // finish moves
{
FSensorBlockRunout fsBlockRunout;
@ -8625,7 +8625,10 @@ Sigma_Exit:
*/
case 702:
{
// TODO: Implement U parameter
float unloadLength = FILAMENTCHANGE_FINALRETRACT;
if (code_seen('U')) {
unloadLength = code_value();
}
if (code_seen('Z'))
{
@ -8635,11 +8638,10 @@ Sigma_Exit:
raise_z_above(MIN_Z_FOR_UNLOAD, false);
}
if (MMU2::mmu2.Enabled())
{
if (MMU2::mmu2.Enabled()) {
MMU2::mmu2.unload();
} else {
unload_filament();
unload_filament(unloadLength, false);
}
}
break;

View File

@ -4107,7 +4107,7 @@ void lcd_wizard(WizState state)
lcd_display_message_fullscreen_P(_i("Now I will preheat nozzle for PLA.")); ////MSG_WIZARD_WILL_PREHEAT c=20 r=4
wait_preheat();
//unload current filament
unload_filament(true);
unload_filament(FILAMENTCHANGE_FINALRETRACT, true);
//load filament
lcd_wizard_load();
setTargetHotend(0, 0); //we are finished, cooldown nozzle
@ -5249,7 +5249,7 @@ static void mmu_load_to_bondtech_menu() {
// unload filament for single material printer (used in M702 gcode)
// @param automatic: If true, unload_filament is part of a unload+load sequence (M600)
void unload_filament(bool automatic)
void unload_filament(float unloadLength, bool automatic)
{
custom_message_type = CustomMsg::FilamentLoading;
lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT));
@ -5262,17 +5262,9 @@ void unload_filament(bool automatic)
raise_z_above(MIN_Z_FOR_SWAP);
}
// extr_unload2();
current_position[E_AXIS] -= 45;
plan_buffer_line_curposXYZE(5200 / 60);
st_synchronize();
current_position[E_AXIS] -= 15;
plan_buffer_line_curposXYZE(1000 / 60);
st_synchronize();
current_position[E_AXIS] -= 20;
plan_buffer_line_curposXYZE(1000 / 60);
st_synchronize();
current_position[E_AXIS] -= unloadLength;
plan_buffer_line_curposXYZE(1000 / 60);
st_synchronize();
lcd_display_message_fullscreen_P(_T(MSG_PULL_OUT_FILAMENT));

View File

@ -191,7 +191,7 @@ extern bool bFilamentAction;
void mFilamentItem(uint16_t nTemp,uint16_t nTempBed);
void mFilamentItemForce();
void lcd_generic_preheat_menu();
void unload_filament(bool automatic = false);
void unload_filament(float unloadLength, bool automatic = false);
void lcd_wait_for_heater();