From 901b03d0208f65f1e193f6172f05d4d4be35f330 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Sat, 7 Mar 2015 17:24:26 -0500 Subject: [PATCH 1/2] use strtol() instead of strtod() when an integer value is desired --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b3c1702a56..322573060d 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -765,7 +765,7 @@ void get_command() while(cmdbuffer[bufindw][count] != '*') checksum = checksum^cmdbuffer[bufindw][count++]; strchr_pointer = strchr(cmdbuffer[bufindw], '*'); - if( (int)(strtod(strchr_pointer + 1, NULL)) != checksum) { + if(strtol(strchr_pointer + 1, NULL, 10) != checksum) { SERIAL_ERROR_START; SERIAL_ERRORPGM(MSG_ERR_CHECKSUM_MISMATCH); SERIAL_ERRORLN(gcode_LastN); @@ -801,7 +801,7 @@ void get_command() } if((strchr(cmdbuffer[bufindw], 'G') != NULL)){ strchr_pointer = strchr(cmdbuffer[bufindw], 'G'); - switch((int)((strtod(strchr_pointer + 1, NULL)))){ + switch(strtol(strchr_pointer + 1, NULL, 10)){ case 0: case 1: case 2: From b9dfa5cad4730c5bb665bc8edc6f4bc945ecdf68 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Sat, 7 Mar 2015 17:33:15 -0500 Subject: [PATCH 2/2] use code_value_long() instead of (int)code_value() --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 322573060d..db53c0e134 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4198,7 +4198,7 @@ inline void gcode_M350() { */ inline void gcode_M351() { #if defined(X_MS1_PIN) && X_MS1_PIN > -1 - if (code_seen('S')) switch((int)code_value()) { + if (code_seen('S')) switch(code_value_long()) { case 1: for(int i=0;i