Restore previous Z-lift in M701/M702

Previously when the firmware called M701/M702 manually
there was no Z lift. But after we added support for the Z
parameter we set the default to 50mm.

Change strings "M701" to "M701 Z0" and "M702" to "M702 Z0"
to restore the previous behavior from before 3.13.

Also pulled the gcodes into PROGMEM in message.cpp
along with M83 and M84 to save memory.

Change in memory:
Flash: -34 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-03-18 15:34:47 +00:00
parent 16ec3e376f
commit 5f8fc64a32
5 changed files with 27 additions and 18 deletions

View File

@ -2082,7 +2082,7 @@ bool check_commands() {
while (buflen)
{
if ((code_seen_P(PSTR("M84"))) || (code_seen_P(PSTR("M 84")))) end_command_found = true;
if ((code_seen_P(MSG_M84)) || (code_seen_P(PSTR("M 84")))) end_command_found = true;
if (!cmdbuffer_front_already_processed)
cmdqueue_pop_front();
cmdbuffer_front_already_processed = false;
@ -10783,7 +10783,7 @@ void recover_print(uint8_t automatic) {
sprintf_P(cmd, PSTR("M109 S%d"), target_temperature[active_extruder]);
enquecommand(cmd);
enquecommand_P(PSTR("M83")); //E axis relative mode
enquecommand_P(MSG_M83); //E axis relative mode
// If not automatically recoreverd (long power loss)
if(automatic == 0){
@ -11150,7 +11150,7 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
{
// First unretract (relative extrusion)
if(!saved_extruder_relative_mode){
enquecommand(PSTR("M83"), true);
enquecommand_P(MSG_M83);
}
//retract 45mm/s
// A single sprintf may not be faster, but is definitely 20B shorter

View File

@ -62,7 +62,7 @@ bool lay1cal_load_filament(char *cmd_buffer, uint8_t filament)
{
if (MMU2::mmu2.Enabled())
{
enquecommand_P(PSTR("M83"));
enquecommand_P(MSG_M83);
enquecommand_P(PSTR("G1 Y-3 F1000"));
enquecommand_P(PSTR("G1 Z0.4 F1000"));
@ -72,7 +72,7 @@ bool lay1cal_load_filament(char *cmd_buffer, uint8_t filament)
return false;
} else if( currentTool != (uint8_t)MMU2::FILAMENT_UNKNOWN){
// some other slot is loaded, perform an unload first
enquecommand_P(PSTR("M702"));
enquecommand_P(MSG_M702_NO_LIFT);
}
// perform a toolchange
// sprintf_P(cmd_buffer, PSTR("T%d"), filament);
@ -142,7 +142,6 @@ void lay1cal_before_meander()
{
static const char cmd_pre_meander_1[] PROGMEM = "G21"; //set units to millimeters TODO unsupported command
static const char cmd_pre_meander_2[] PROGMEM = "G90"; //use absolute coordinates
static const char cmd_pre_meander_3[] PROGMEM = "M83"; //use relative distances for extrusion TODO: duplicate
static const char cmd_pre_meander_4[] PROGMEM = "G1 E-1.5 F2100";
static const char cmd_pre_meander_5[] PROGMEM = "G1 Z5 F7200";
static const char cmd_pre_meander_6[] PROGMEM = "M204 S1000"; //set acceleration
@ -153,7 +152,7 @@ void lay1cal_before_meander()
zero_extrusion,
cmd_pre_meander_1,
cmd_pre_meander_2,
cmd_pre_meander_3,
MSG_M83, // use relative distances for extrusion
cmd_pre_meander_4,
cmd_pre_meander_5,
cmd_pre_meander_6,
@ -254,8 +253,6 @@ void lay1cal_finish(bool mmu_enabled)
static const char cmd_cal_finish_3[] PROGMEM = "M140 S0"; // turn off heatbed
static const char cmd_cal_finish_4[] PROGMEM = "G1 Z10 F1300"; //lift Z
static const char cmd_cal_finish_5[] PROGMEM = "G1 X10 Y180 F4000"; //Go to parking position
static const char cmd_cal_finish_6[] PROGMEM = "M702"; //unload from nozzle
static const char cmd_cal_finish_7[] PROGMEM = "M84";// disable motors
static const char * const cmd_cal_finish[] PROGMEM =
{
@ -272,6 +269,6 @@ void lay1cal_finish(bool mmu_enabled)
enquecommand_P(static_cast<char*>(pgm_read_ptr(&cmd_cal_finish[i])));
}
if (mmu_enabled) enquecommand_P(cmd_cal_finish_6); //unload from nozzle
enquecommand_P(cmd_cal_finish_7);// disable motors
if (mmu_enabled) enquecommand_P(MSG_M702_NO_LIFT); //unload from nozzle
enquecommand_P(MSG_M84);// disable motors
}

View File

@ -228,3 +228,9 @@ const char MSG_ADVANCE_K[] PROGMEM_N1 = "Advance K:"; ////c=13
const char MSG_POWERPANIC_DETECTED[] PROGMEM_N1 = "POWER PANIC DETECTED"; ////c=20
const char MSG_LCD_STATUS_CHANGED[] PROGMEM_N1 = "LCD status changed";
const char MSG_UNKNOWN_CODE[] PROGMEM_N1 = "Unknown %c code: %s\n";
// Common G-gcodes
const char MSG_M701_NO_LIFT[] PROGMEM_N1 = "M701 Z0";
const char MSG_M702_NO_LIFT[] PROGMEM_N1 = "M702 Z0";
const char MSG_M83[] PROGMEM_N1 = "M83";
const char MSG_M84[] PROGMEM_N1 = "M84";

View File

@ -235,6 +235,12 @@ extern const char MSG_POWERPANIC_DETECTED[];
extern const char MSG_LCD_STATUS_CHANGED[];
extern const char MSG_UNKNOWN_CODE[];
// Common G-gcodes
extern const char MSG_M701_NO_LIFT[];
extern const char MSG_M702_NO_LIFT[];
extern const char MSG_M83[];
extern const char MSG_M84[];
#if defined(__cplusplus)
}
#endif //defined(__cplusplus)

View File

@ -1847,10 +1847,10 @@ switch(eFilamentAction)
// FALLTHRU
case FilamentAction::Load:
loading_flag=true;
enquecommand_P(PSTR("M701")); // load filament
enquecommand_P(MSG_M701_NO_LIFT); // load filament
break;
case FilamentAction::UnLoad:
enquecommand_P(PSTR("M702")); // unload filament
enquecommand_P(MSG_M702_NO_LIFT); // unload filament
break;
case FilamentAction::MmuLoad:
case FilamentAction::MmuLoadingTest:
@ -1908,11 +1908,11 @@ void mFilamentItem(uint16_t nTemp, uint16_t nTempBed)
if ((eFilamentAction == FilamentAction::Load) || (eFilamentAction == FilamentAction::AutoLoad))
{
loading_flag = true;
enquecommand_P(PSTR("M701")); // load filament
enquecommand_P(MSG_M701_NO_LIFT); // load filament
if (eFilamentAction == FilamentAction::AutoLoad) eFilamentAction = FilamentAction::None; // i.e. non-autoLoad
}
if (eFilamentAction == FilamentAction::UnLoad)
enquecommand_P(PSTR("M702")); // unload filament
enquecommand_P(MSG_M702_NO_LIFT); // unload filament
}
break;
case FilamentAction::MmuLoad:
@ -3804,7 +3804,7 @@ static void lcd_wizard_load() {
loading_flag = true;
}
gcode_M701(FILAMENTCHANGE_FIRSTFEED, 0);
//enquecommand_P(PSTR("M701"));
//enquecommand_P(MSG_M701_NO_LIFT); // is enqueuecommand_P safe here?
}
static void wizard_lay1cal_message(bool cold)
@ -4593,7 +4593,7 @@ static void lcd_settings_menu()
if (!printer_active() || isPrintPaused)
{
MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_axis);////MSG_MOVE_AXIS c=18
MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=18
MENU_ITEM_GCODE_P(_i("Disable steppers"), MSG_M84);////MSG_DISABLE_STEPPERS c=18
}
#ifdef FILAMENT_SENSOR
@ -6363,7 +6363,7 @@ bool lcd_selftest()
_progress = lcd_selftest_screen(TestScreen::Failed, _progress, 3, true, 5000);
}
lcd_reset_alert_level();
enquecommand_P(PSTR("M84"));
enquecommand_P(MSG_M84);
lcd_update_enable(true);
if (_result)