From 3e8c5678f547fa99457ab5a67c20c98cedf651d2 Mon Sep 17 00:00:00 2001 From: Greg Alexander Date: Sat, 7 Mar 2015 21:10:40 -0500 Subject: [PATCH] fix bug where, i.e., "G1X1E1" would be interpretted as "G1 X10 E1", because strtod() will read the E address value as if it was a base 10 exponent. --- Marlin/Marlin_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b3c1702a5..491216da1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -909,7 +909,12 @@ void get_command() float code_value() { - return (strtod(strchr_pointer + 1, NULL)); + float ret; + char *e = strchr(strchr_pointer, 'E'); + if (e != NULL) *e = 0; + ret = strtod(strchr_pointer+1, NULL); + if (e != NULL) *e = 'E'; + return ret; } long code_value_long()