Skip to content

Commit

Permalink
Restore old M701/M702 behavior
Browse files Browse the repository at this point in the history
If the new Z parameter is not given,
assume that the old Z-lift behavior is desired.

Change in memory:
Flash: -28 bytes
SRAM: 0 bytes
  • Loading branch information
gudnimg committed Apr 29, 2023
1 parent d7127c4 commit 26369ac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8417,6 +8417,7 @@ 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);
Expand Down Expand Up @@ -8447,6 +8448,7 @@ SERIAL_PROTOCOLPGM("\n\n");

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

// Raise the Z axis
float delta = raise_z(z_target);
Expand Down
4 changes: 2 additions & 2 deletions Firmware/first_lay_cal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool lay1cal_load_filament(uint8_t filament)
return false;
} else if( currentTool != (uint8_t)MMU2::FILAMENT_UNKNOWN){
// some other slot is loaded, perform an unload first
enquecommand_P(MSG_M702_NO_LIFT);
enquecommand_P(MSG_M702);
}
// perform a toolchange
enquecommandf_P(PSTR("T%d"), filament);
Expand Down Expand Up @@ -245,6 +245,6 @@ void lay1cal_finish(bool mmu_enabled)

lay1cal_common_enqueue_loop(cmd_cal_finish, (sizeof(cmd_cal_finish)/sizeof(cmd_cal_finish[0])));

if (mmu_enabled) enquecommand_P(MSG_M702_NO_LIFT); //unload from nozzle
if (mmu_enabled) enquecommand_P(MSG_M702); //unload from nozzle
enquecommand_P(MSG_M84);// disable motors
}
4 changes: 2 additions & 2 deletions Firmware/messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@ const char MSG_M107[] PROGMEM_N1 = "M107";
const char MSG_M220[] PROGMEM_N1 = "M220 S%d";
const char MSG_M500[] PROGMEM_N1 = "M500";
const char MSG_M600[] PROGMEM_N1 = "M600";
const char MSG_M701_NO_LIFT[] PROGMEM_N1 = "M701 Z0";
const char MSG_M702_NO_LIFT[] PROGMEM_N1 = "M702 Z0";
const char MSG_M701[] PROGMEM_N1 = "M701";
const char MSG_M702[] PROGMEM_N1 = "M702";
4 changes: 2 additions & 2 deletions Firmware/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ extern const char MSG_M107[];
extern const char MSG_M220[];
extern const char MSG_M500[];
extern const char MSG_M600[];
extern const char MSG_M701_NO_LIFT[];
extern const char MSG_M702_NO_LIFT[];
extern const char MSG_M701[];
extern const char MSG_M702[];

#if defined(__cplusplus)
}
Expand Down
11 changes: 5 additions & 6 deletions Firmware/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1805,10 +1805,10 @@ switch(eFilamentAction)
// FALLTHRU
case FilamentAction::Load:
loading_flag=true;
enquecommand_P(MSG_M701_NO_LIFT); // load filament
enquecommand_P(MSG_M701); // load filament
break;
case FilamentAction::UnLoad:
enquecommand_P(MSG_M702_NO_LIFT); // unload filament
enquecommand_P(MSG_M702); // unload filament
break;
case FilamentAction::MmuLoad:
case FilamentAction::MmuLoadingTest:
Expand Down Expand Up @@ -1868,11 +1868,11 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
if ((eFilamentAction == FilamentAction::Load) || (eFilamentAction == FilamentAction::AutoLoad))
{
loading_flag = true;
enquecommand_P(MSG_M701_NO_LIFT); // load filament
enquecommand_P(MSG_M701); // load filament
if (eFilamentAction == FilamentAction::AutoLoad) eFilamentAction = FilamentAction::None; // i.e. non-autoLoad
}
if (eFilamentAction == FilamentAction::UnLoad)
enquecommand_P(MSG_M702_NO_LIFT); // unload filament
enquecommand_P(MSG_M702); // unload filament
}
break;
case FilamentAction::MmuLoad:
Expand Down Expand Up @@ -3717,8 +3717,7 @@ static void lcd_wizard_load() {
lcd_puts_at_P(0, 2, _T(MSG_LOADING_FILAMENT));
loading_flag = true;
}
gcode_M701(FILAMENTCHANGE_FIRSTFEED, 0);
//enquecommand_P(MSG_M701_NO_LIFT); // is enqueuecommand_P safe here?
enquecommand_P(MSG_M701);
}

static void wizard_lay1cal_message(bool cold)
Expand Down

0 comments on commit 26369ac

Please sign in to comment.