From bc27b7172929ff0bd73527d27d6e55cfbce331da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 18 Mar 2023 17:37:27 +0000 Subject: [PATCH] Pull one common G1 gcode into PROGMEM Change in memory: Flash: -32 bytes SRAM: 0 bytes --- Firmware/Marlin_main.cpp | 6 +++--- Firmware/messages.cpp | 1 + Firmware/messages.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 80fbb0e7f..3cee10a55 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -10789,7 +10789,7 @@ void recover_print(uint8_t automatic) { //Extrude some filament to stabilize the pressure enquecommand_P(PSTR("G1 E5 F120")); // 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); } @@ -10946,7 +10946,7 @@ void restore_print_from_eeprom(bool mbl_was_active) { enquecommand(cmd); // Unretract. - sprintf_P(cmd, PSTR("G1 E%0.3f F2700"), default_retraction); + sprintf_P(cmd, G1_E_F2700, default_retraction); enquecommand(cmd); // Recover final E axis position and mode 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 // 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 - sprintf_P(buf, PSTR("G1 E%-0.3f F2700"), e_move); + sprintf_P(buf, G1_E_F2700, e_move); enquecommand(buf, false); } diff --git a/Firmware/messages.cpp b/Firmware/messages.cpp index 577570439..988a00d0c 100644 --- a/Firmware/messages.cpp +++ b/Firmware/messages.cpp @@ -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"; // Common G-gcodes +const char G1_E_F2700[] PROGMEM_N1 = "G1 E%-0.3f F2700"; const char G28W0[] PROGMEM_N1 = "G28 W0"; const char MSG_M23[] PROGMEM_N1 = "M23 %s"; const char MSG_M24[] PROGMEM_N1 = "M24"; diff --git a/Firmware/messages.h b/Firmware/messages.h index d6b67e05e..81ba55bd8 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -236,6 +236,7 @@ extern const char MSG_LCD_STATUS_CHANGED[]; extern const char MSG_UNKNOWN_CODE[]; // Common G-gcodes +extern const char G1_E_F2700[]; extern const char G28W0[]; extern const char MSG_M23[]; extern const char MSG_M24[];