Change G4 Pxxx in grbl mode to be float seconds not milliseconds to be compatible...
authorJim Morris <morris@wolfman.com>
Wed, 28 Dec 2016 01:00:35 +0000 (17:00 -0800)
committerJim Morris <morris@wolfman.com>
Wed, 28 Dec 2016 01:00:35 +0000 (17:00 -0800)
src/modules/robot/Robot.cpp

index 6503a97..141379f 100644 (file)
@@ -421,10 +421,18 @@ void Robot::on_gcode_received(void *argument)
             case 1:  motion_mode = LINEAR;  break;
             case 2:  motion_mode = CW_ARC;  break;
             case 3:  motion_mode = CCW_ARC; break;
-            case 4: { // G4 pause
+            case 4: { // G4 Dwell
                 uint32_t delay_ms = 0;
                 if (gcode->has_letter('P')) {
-                    delay_ms = gcode->get_int('P');
+                    if(THEKERNEL->is_grbl_mode()) {
+                        // in grbl mode (and linuxcnc) P is decimal seconds
+                        float f= gcode->get_value('P');
+                        delay_ms= f * 1000.0F;
+
+                    }else{
+                        // in reprap P is milliseconds, they always have to be different!
+                        delay_ms = gcode->get_int('P');
+                    }
                 }
                 if (gcode->has_letter('S')) {
                     delay_ms += gcode->get_int('S') * 1000;