Fix initial pause at start of print
authorJim Morris <morris@wolfman.com>
Tue, 24 Jun 2014 23:27:27 +0000 (16:27 -0700)
committerJim Morris <morris@wolfman.com>
Tue, 24 Jun 2014 23:27:27 +0000 (16:27 -0700)
src/modules/communication/utils/Gcode.cpp
src/modules/robot/Block.cpp

index 48e337b..71810fc 100644 (file)
@@ -155,10 +155,10 @@ void Gcode::mark_as_taken()
     this->accepted_by_module = true;
 }
 
-// strip off X Y Z I J parameters if G0/1/2/3
+// strip off X Y Z I J parameters if G0/1/2/3
 void Gcode::strip_parameters()
 {
-    if(has_g && g <= 4){
+    if(has_g && g < 4){
         // strip the command of the XYZIJK parameters
         string newcmd;
         char *cn= command;
@@ -173,12 +173,13 @@ void Gcode::strip_parameters()
             char *eos;
             strtof(pch+1, &eos);
             cn= eos; // point to end of last parameter
-            pch= strpbrk(cn, "XYZIJ"); // find next parameter
+            pch= strpbrk(cn, "XYZIJK"); // find next parameter
         }
         // append anything left on the line
         newcmd.append(cn);
-        // strip whitespace to save even more
-        newcmd.erase(std::remove_if(newcmd.begin(), newcmd.end(), ::isspace), newcmd.end());
+
+        // strip whitespace to save even more, this causes problems so don't do it
+        //newcmd.erase(std::remove_if(newcmd.begin(), newcmd.end(), ::isspace), newcmd.end());
 
         // release the old one
         free(command);
index b4497d8..3d4fceb 100644 (file)
@@ -240,7 +240,7 @@ float Block::max_exit_speed()
 void Block::append_gcode(Gcode* gcode)
 {
     Gcode new_gcode = *gcode;
-    new_gcode.strip_parameters(); // optimization to save memory we strip off the XYZIJ parameters from the saved command
+    new_gcode.strip_parameters(); // optimization to save memory we strip off the XYZIJK parameters from the saved command
     gcodes.push_back(new_gcode);
 }