Pull one common G1 gcode into PROGMEM

Change in memory:
Flash: -32 bytes
SRAM: 0 bytes
This commit is contained in:
Guðni Már Gilbert 2023-03-18 17:37:27 +00:00
parent f296b3f826
commit bc27b71729
3 changed files with 5 additions and 3 deletions

View File

@ -10789,7 +10789,7 @@ void recover_print(uint8_t automatic) {
//Extrude some filament to stabilize the pressure //Extrude some filament to stabilize the pressure
enquecommand_P(PSTR("G1 E5 F120")); enquecommand_P(PSTR("G1 E5 F120"));
// Retract to be consistent with a short pause // Retract to be consistent with a short pause
sprintf_P(cmd, PSTR("G1 E%-0.3f F2700"), default_retraction); sprintf_P(cmd, G1_E_F2700, default_retraction);
enquecommand(cmd); enquecommand(cmd);
} }
@ -10946,7 +10946,7 @@ void restore_print_from_eeprom(bool mbl_was_active) {
enquecommand(cmd); enquecommand(cmd);
// Unretract. // Unretract.
sprintf_P(cmd, PSTR("G1 E%0.3f F2700"), default_retraction); sprintf_P(cmd, G1_E_F2700, default_retraction);
enquecommand(cmd); enquecommand(cmd);
// Recover final E axis position and mode // Recover final E axis position and mode
float pos_e = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E)); float pos_e = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
@ -11157,7 +11157,7 @@ void stop_and_save_print_to_ram(float z_move, float e_move)
// A snprintf would have been a safer call, but since it is not used // A snprintf would have been a safer call, but since it is not used
// in the whole program, its implementation would bring more bytes to the total size // in the whole program, its implementation would bring more bytes to the total size
// The behavior of dtostrf 8,3 should be roughly the same as %-0.3 // The behavior of dtostrf 8,3 should be roughly the same as %-0.3
sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move); sprintf_P(buf, G1_E_F2700, e_move);
enquecommand(buf, false); enquecommand(buf, false);
} }

View File

@ -230,6 +230,7 @@ const char MSG_LCD_STATUS_CHANGED[] PROGMEM_N1 = "LCD status changed";
const char MSG_UNKNOWN_CODE[] PROGMEM_N1 = "Unknown %c code: %s\n"; const char MSG_UNKNOWN_CODE[] PROGMEM_N1 = "Unknown %c code: %s\n";
// Common G-gcodes // Common G-gcodes
const char G1_E_F2700[] PROGMEM_N1 = "G1 E%-0.3f F2700";
const char G28W0[] PROGMEM_N1 = "G28 W0"; const char G28W0[] PROGMEM_N1 = "G28 W0";
const char MSG_M23[] PROGMEM_N1 = "M23 %s"; const char MSG_M23[] PROGMEM_N1 = "M23 %s";
const char MSG_M24[] PROGMEM_N1 = "M24"; const char MSG_M24[] PROGMEM_N1 = "M24";

View File

@ -236,6 +236,7 @@ extern const char MSG_LCD_STATUS_CHANGED[];
extern const char MSG_UNKNOWN_CODE[]; extern const char MSG_UNKNOWN_CODE[];
// Common G-gcodes // Common G-gcodes
extern const char G1_E_F2700[];
extern const char G28W0[]; extern const char G28W0[];
extern const char MSG_M23[]; extern const char MSG_M23[];
extern const char MSG_M24[]; extern const char MSG_M24[];