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.
This commit is contained in:
parent
478627b6bc
commit
46852e9941
|
|
@ -8022,7 +8022,9 @@ Sigma_Exit:
|
|||
*/
|
||||
case 862: // M862: print checking
|
||||
{
|
||||
ClPrintChecking nCommand = static_cast<ClPrintChecking>(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<ClPrintChecking>((uint16_t)(code_value()*10) - 8620u);
|
||||
switch(nCommand)
|
||||
{
|
||||
case ClPrintChecking::_Nozzle: // ~ .1
|
||||
|
|
|
|||
Loading…
Reference in New Issue