From 6d98e99356f997282c57d56f7b92f9a6e1b9a120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 26 Feb 2022 15:25:30 +0000 Subject: [PATCH] Use sprintf_P for M301 instead of ftostr32 Also fixed indentation of if statement Saves 248 bytes of flash --- Firmware/ultralcd.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index c5b3e63ac..2e8072e39 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1031,14 +1031,9 @@ void lcd_commands() lcd_setstatuspgm(_i("PID cal. finished"));////MSG_PID_FINISHED c=20 setAllTargetHotends(0); // reset all hotends temperature including the number displayed on the main screen if (_Kp != 0 || _Ki != 0 || _Kd != 0) { - strcpy_P(cmd1, PSTR("M301 P")); - strcat(cmd1, ftostr32(_Kp)); - strcat_P(cmd1, PSTR(" I")); - strcat(cmd1, ftostr32(_Ki)); - strcat_P(cmd1, PSTR(" D")); - strcat(cmd1, ftostr32(_Kd)); - enquecommand(cmd1); - enquecommand_P(PSTR("M500")); + sprintf_P(cmd1, PSTR("M301 P%.2f I%.2f D%.2f"), _Kp, _Ki, _Kd); + enquecommand(cmd1); + enquecommand_P(PSTR("M500")); } else { SERIAL_ECHOPGM("Invalid PID cal. results. Not stored to EEPROM.");