From 46852e99414458bee1f78e2c572e2d5d856011c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 21 Jan 2023 16:33:35 +0000 Subject: [PATCH] M862: determine decimal through math rather than checking for null byte/pointer. This way doesn't add any more flash memory. Calculating the string length or checking for a null byte will end up increasing flash consumption overall. --- Firmware/Marlin_main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index e0f9462a0..2af7038bf 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -8022,7 +8022,9 @@ Sigma_Exit: */ case 862: // M862: print checking { - ClPrintChecking nCommand = static_cast(strtol(strchr_pointer+5, NULL, 10)); + // Read the decimal by multiplying the float value by 10 e.g. 862.1 becomes 8621 + // This method consumes less flash memory compared to checking the string length. + ClPrintChecking nCommand = static_cast((uint16_t)(code_value()*10) - 8620u); switch(nCommand) { case ClPrintChecking::_Nozzle: // ~ .1