? G64_Pn_Qn.patch
? interpl_len_from_ini.patch
Index: nml_intf/canon.hh
===================================================================
RCS file: /cvs/emc2/src/emc/nml_intf/canon.hh,v
retrieving revision 1.42
diff -U3 -r1.42 canon.hh
--- nml_intf/canon.hh	24 May 2009 05:11:20 -0000	1.42
+++ nml_intf/canon.hh	27 May 2009 08:35:02 -0000
@@ -344,6 +344,8 @@
 
 extern void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode, double tolerance);
 
+extern void SET_NAIVECAM_TOLERANCE(double tolerance);
+
 /*
 
 This sets the motion control mode to one of: CANON_EXACT_STOP,
Index: rs274ngc/gcodemodule.cc
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/gcodemodule.cc,v
retrieving revision 1.47
diff -U3 -r1.47 gcodemodule.cc
--- rs274ngc/gcodemodule.cc	24 May 2009 05:11:19 -0000	1.47
+++ rs274ngc/gcodemodule.cc	27 May 2009 08:35:08 -0000
@@ -698,6 +698,7 @@
 void SET_MOTION_CONTROL_MODE(double tolerance) { }
 void SET_MOTION_CONTROL_MODE(CANON_MOTION_MODE mode) { motion_mode = mode; }
 CANON_MOTION_MODE GET_EXTERNAL_MOTION_CONTROL_MODE() { return motion_mode; }
+void SET_NAIVECAM_TOLERANCE(double tolerance) { }
 
 #define RESULT_OK (result == INTERP_OK || result == INTERP_EXECUTE_FINISH)
 PyObject *parse_file(PyObject *self, PyObject *args) {
Index: rs274ngc/interp_check.cc
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/interp_check.cc,v
retrieving revision 1.30
diff -U3 -r1.30 interp_check.cc
--- rs274ngc/interp_check.cc	6 May 2009 18:36:28 -0000	1.30
+++ rs274ngc/interp_check.cc	27 May 2009 08:35:11 -0000
@@ -327,7 +327,7 @@
 
   if (block->q_number != -1.0) {
       CHKS((motion != G_83) && (motion != G_73) && (motion != G_5) && (block->user_m != 1) && (motion != G_76) &&
-          (block->m_modes[5] != 66) && (block->g_modes[0] != G_10) && (block->m_modes[6] != 61), 
+          (block->m_modes[5] != 66) && (block->g_modes[0] != G_10) && (block->m_modes[6] != 61) && (block->g_modes[13] != G_64), 
           "Q word with no g code that uses it");
   }
 
Index: rs274ngc/interp_convert.cc
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/interp_convert.cc,v
retrieving revision 1.153
diff -U3 -r1.153 interp_convert.cc
--- rs274ngc/interp_convert.cc	24 May 2009 15:45:29 -0000	1.153
+++ rs274ngc/interp_convert.cc	27 May 2009 08:35:53 -0000
@@ -1440,6 +1440,7 @@
 
 int Interp::convert_control_mode(int g_code,     //!< g_code being executed (G_61, G61_1, || G_64)
 				double tolerance,    //tolerance for the path following in G64
+				double naivecam_tolerance,    //tolerance for the naivecam
                                 setup_pointer settings) //!< pointer to machine settings                 
 {
   CHKS((settings->cutter_comp_side != OFF),
@@ -1456,6 +1457,13 @@
 	} else {
 	    SET_MOTION_CONTROL_MODE(CANON_CONTINUOUS, 0);
 	}
+	if (naivecam_tolerance >= 0) {
+	    SET_NAIVECAM_TOLERANCE(naivecam_tolerance);
+	} else if (tolerance >= 0) {
+	    SET_NAIVECAM_TOLERANCE(tolerance);   // if no naivecam_tolerance specified use same for both
+	} else {
+	    SET_NAIVECAM_TOLERANCE(0);
+	}
     settings->control_mode = CANON_CONTINUOUS;
   } else 
     ERS(NCE_BUG_CODE_NOT_G61_G61_1_OR_G64);
@@ -2178,7 +2186,7 @@
     CHP(convert_coordinate_system(block->g_modes[12], settings));
   }
   if (block->g_modes[13] != -1) {
-    CHP(convert_control_mode(block->g_modes[13], block->p_number, settings));
+    CHP(convert_control_mode(block->g_modes[13], block->p_number, block->q_number, settings));
   }
   if (block->g_modes[3] != -1) {
     CHP(convert_distance_mode(block->g_modes[3], settings));
Index: rs274ngc/rs274ngc.hh
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/rs274ngc.hh,v
retrieving revision 1.52
diff -U3 -r1.52 rs274ngc.hh
--- rs274ngc/rs274ngc.hh	24 May 2009 05:11:19 -0000	1.52
+++ rs274ngc/rs274ngc.hh	27 May 2009 08:35:57 -0000
@@ -219,7 +219,7 @@
                                 setup_pointer settings);
  int convert_param_comment(char *comment, char *expanded, int len);
  int convert_comment(char *comment);
- int convert_control_mode(int g_code, double tolerance, setup_pointer settings);
+ int convert_control_mode(int g_code, double tolerance, double naivecam_tolerance, setup_pointer settings);
  int convert_adaptive_mode(int g_code, setup_pointer settings);
 
  int convert_coordinate_system(int g_code, setup_pointer settings);
Index: sai/saicanon.cc
===================================================================
RCS file: /cvs/emc2/src/emc/sai/saicanon.cc,v
retrieving revision 1.28
diff -U3 -r1.28 saicanon.cc
--- sai/saicanon.cc	24 May 2009 05:11:18 -0000	1.28
+++ sai/saicanon.cc	27 May 2009 08:36:01 -0000
@@ -411,6 +411,11 @@
     PRINT0("SET_MOTION_CONTROL_MODE(UNKNOWN)\n");
 }
 
+extern void SET_NAIVECAM_TOLERANCE(double tolerance)
+{
+  PRINT1("SET_NAIVECAM_TOLERANCE(%.4f)\n", tolerance);
+}
+
 void SELECT_PLANE(CANON_PLANE in_plane)
 {
   PRINT1("SELECT_PLANE(CANON_PLANE_%s)\n",
Index: task/emccanon.cc
===================================================================
RCS file: /cvs/emc2/src/emc/task/emccanon.cc,v
retrieving revision 1.160
diff -U3 -r1.160 emccanon.cc
--- task/emccanon.cc	26 May 2009 21:13:18 -0000	1.160
+++ task/emccanon.cc	27 May 2009 08:36:15 -0000
@@ -371,6 +371,7 @@
    almost any deviation trying to keep speed up. */
 static double canonMotionTolerance = 0.0;
 
+static double canonNaivecamTolerance = 0.0;
 
 /* Spindle speed is saved here */
 static double spindleSpeed = 0.0;
@@ -862,7 +863,7 @@
          double a, double b, double c, 
          double u, double v, double w) {
     struct pt &pos = chained_points().back();
-    if(canonMotionMode != CANON_CONTINUOUS || canonMotionTolerance == 0)
+    if(canonMotionMode != CANON_CONTINUOUS || canonNaivecamTolerance == 0)
         return false;
 
     if(chained_points().size() > 100) return false;
@@ -1096,6 +1097,16 @@
     return canonMotionTolerance;
 }
 
+void SET_NAIVECAM_TOLERANCE(double tolerance)
+{
+    canonNaivecamTolerance =  FROM_PROG_LEN(tolerance);
+}
+
+double GET_NAIVECAM_TOLERANCE()
+{
+    return canonNaivecamTolerance;
+}
+
 void SELECT_PLANE(CANON_PLANE in_plane)
 {
     activePlane = in_plane;
@@ -1382,7 +1393,7 @@
             && chord_deviation(lx, ly,
                 offset_x(FROM_PROG_LEN(first_end)), offset_y(FROM_PROG_LEN(second_end)),
                 offset_x(FROM_PROG_LEN(first_axis)), offset_y(FROM_PROG_LEN(second_axis)),
-                rotation, mx, my) < canonMotionTolerance) {
+                rotation, mx, my) < canonNaivecamTolerance) {
         double x=FROM_PROG_LEN(first_end), y=FROM_PROG_LEN(second_end), z=FROM_PROG_LEN(axis_end_point);
         rotate_and_offset_pos(x, y, z, a, b, c, u, v, w);
         see_segment(line_number, mx, my,
