All pastes #219424 Raw Edit

Miscellany

public text v1 · immutable
#219424 ·published 2006-10-24 17:57 UTC
rendered paste body
? block_delete.diff
? m48m49.diff
? hal/utils/comp.py
Index: emc/canterp/canterp.cc
===================================================================
RCS file: /cvs/emc2/src/emc/canterp/canterp.cc,v
retrieving revision 1.13
diff -u -p -r1.13 canterp.cc
--- emc/canterp/canterp.cc	9 Sep 2006 07:03:48 -0000	1.13
+++ emc/canterp/canterp.cc	24 Oct 2006 17:55:40 -0000
@@ -262,12 +262,18 @@ int emcTaskPlanSynch(void)
     return 0;
 }
 
-int emcTaskPlanSetOptionalStop(char state)
+int emcTaskPlanSetOptionalStop(ON_OFF state)
 {
     SET_OPTIONAL_PROGRAM_STOP(state);
     return 0;
 }
 
+int emcTaskPlanSetBlockDelete(ON_OFF state)
+{
+    SET_BLOCK_DELETE(state);
+    return 0;
+}
+
 int emcTaskPlanExit(void)
 {
     return 0;
Index: emc/nml_intf/canon.hh
===================================================================
RCS file: /cvs/emc2/src/emc/nml_intf/canon.hh,v
retrieving revision 1.14
diff -u -p -r1.14 canon.hh
--- emc/nml_intf/canon.hh	8 Sep 2006 22:30:28 -0000	1.14
+++ emc/nml_intf/canon.hh	24 Oct 2006 17:55:41 -0000
@@ -60,6 +60,10 @@
 #define CC
 #endif
 
+typedef bool ON_OFF;
+#define OFF 0
+#define ON 1
+
 typedef int CANON_PLANE;
 #define CANON_PLANE_XY 1
 #define CANON_PLANE_YZ 2
@@ -545,6 +549,17 @@ extern void NURB_CONTROL_POINT(int i, do
 			       double w);
 extern void NURB_FEED(double sStart, double sEnd);
 
+
+/* Block delete */
+extern void SET_BLOCK_DELETE(ON_OFF enabled);
+/* Command to set the internal reference of block delete.
+The ON value for enabled will cause the interpreter to discard lines
+that start with the "/" character. */
+
+extern ON_OFF GET_BLOCK_DELETE(void);
+/* Command to get the internal reference of optional block delete. */
+
+
 /* Program Functions */
 extern void OPTIONAL_PROGRAM_STOP();
 /* If the machining center has an optional stop switch, and it is on
@@ -555,15 +570,14 @@ switch, or commands are being executed w
 already (such as when the interpreter is being used with keyboard
 input), this command has no effect. */
 
-extern void SET_OPTIONAL_PROGRAM_STOP(char state);
+extern void SET_OPTIONAL_PROGRAM_STOP(ON_OFF state);
 /* Command to set the internal reference of optional program stop.
 Any non-zero value for state will cause the execution to stop on
 optional stops. */
 
-extern char GET_OPTIONAL_PROGRAM_STOP();
+extern ON_OFF GET_OPTIONAL_PROGRAM_STOP();
 /* Command to get the internal reference of optional program stop. */
 
-
 extern void PROGRAM_END();
 /* If a program is being read, stop executing the program and be prepared
 to accept a new program or to be shut down. */
Index: emc/nml_intf/emc.cc
===================================================================
RCS file: /cvs/emc2/src/emc/nml_intf/emc.cc,v
retrieving revision 1.29
diff -u -p -r1.29 emc.cc
--- emc/nml_intf/emc.cc	16 Oct 2006 22:23:06 -0000	1.29
+++ emc/nml_intf/emc.cc	24 Oct 2006 17:55:43 -0000
@@ -363,6 +363,12 @@ int emcFormat(NMLTYPE type, void *buffer
     case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
 	((EMC_TASK_PLAN_SET_OPTIONAL_STOP *) buffer)->update(cms);
 	break;
+    case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+	((EMC_TASK_PLAN_SET_BLOCK_DELETE *) buffer)->update(cms);
+	break;
+    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
+	((EMC_TASK_PLAN_OPTIONAL_STOP *) buffer)->update(cms);
+	break;
     case EMC_TASK_SET_MODE_TYPE:
 	((EMC_TASK_SET_MODE *) buffer)->update(cms);
 	break;
@@ -719,6 +725,10 @@ const char *emc_symbol_lookup(long type)
 	return "EMC_TASK_PLAN_SYNCH";
     case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
 	return "EMC_TASK_PLAN_SET_OPTIONAL_STOP";
+    case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+	return "EMC_TASK_PLAN_SET_BLOCK_DELETE";
+    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
+	return "EMC_TASK_PLAN_OPTIONAL_STOP";
     case EMC_TASK_SET_MODE_TYPE:
 	return "EMC_TASK_SET_MODE";
     case EMC_TASK_SET_STATE_TYPE:
@@ -2934,6 +2944,32 @@ void EMC_TASK_PLAN_SET_OPTIONAL_STOP::up
     EMC_TASK_CMD_MSG::update(cms);
 
     cms->update(state);
+    
+}
+
+/*
+*	NML/CMS Update function for EMC_TASK_PLAN_SET_BLOCK_DELETE
+*	Automanually generated by Alex Joni.
+*	on Sun Oct 22 17:30:00 GMT+3 2006
+*/
+void EMC_TASK_PLAN_SET_BLOCK_DELETE::update(CMS * cms)
+{
+
+    EMC_TASK_CMD_MSG::update(cms);
+
+    cms->update(state);
+    
+}
+
+/*
+*	NML/CMS Update function for EMC_TASK_PLAN_OPTIONAL_STOP
+*	Automanually generated by Alex Joni.
+*	on Sat Sep 24 20:25:27 GMT+3 2006
+*/
+void EMC_TASK_PLAN_OPTIONAL_STOP::update(CMS * cms)
+{
+
+    EMC_TASK_CMD_MSG::update(cms);
 
 }
 
Index: emc/nml_intf/emc.hh
===================================================================
RCS file: /cvs/emc2/src/emc/nml_intf/emc.hh,v
retrieving revision 1.42
diff -u -p -r1.42 emc.hh
--- emc/nml_intf/emc.hh	16 Oct 2006 22:23:07 -0000	1.42
+++ emc/nml_intf/emc.hh	24 Oct 2006 17:55:46 -0000
@@ -158,6 +158,8 @@
 #define EMC_TASK_PLAN_INIT_TYPE                      ((NMLTYPE) 515)
 #define EMC_TASK_PLAN_SYNCH_TYPE                     ((NMLTYPE) 516)
 #define EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE         ((NMLTYPE) 517)
+#define EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE          ((NMLTYPE) 518)
+#define EMC_TASK_PLAN_OPTIONAL_STOP_TYPE             ((NMLTYPE) 519)
 
 #define EMC_TASK_STAT_TYPE                           ((NMLTYPE) 599)
 
@@ -472,7 +474,8 @@ extern int emcTaskPlanSetWait();
 extern int emcTaskPlanIsWait();
 extern int emcTaskPlanClearWait();
 extern int emcTaskPlanSynch();
-extern int emcTaskPlanSetOptionalStop(char state);
+extern int emcTaskPlanSetOptionalStop(ON_OFF state);
+extern int emcTaskPlanSetBlockDelete(ON_OFF state);
 extern int emcTaskPlanExit();
 extern int emcTaskPlanOpen(const char *file);
 extern int emcTaskPlanRead();
@@ -1939,7 +1942,30 @@ class EMC_TASK_PLAN_SET_OPTIONAL_STOP:pu
     // For internal NML/CMS use only.
     void update(CMS * cms);
     
-    char state; //state != 0, optional stop is on (e.g. we stop on any stops)
+    ON_OFF state; //state == ON, optional stop is on (e.g. we stop on any stops)
+};
+
+class EMC_TASK_PLAN_SET_BLOCK_DELETE:public EMC_TASK_CMD_MSG {
+  public:
+    EMC_TASK_PLAN_SET_BLOCK_DELETE():EMC_TASK_CMD_MSG(EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE,
+					   sizeof(EMC_TASK_PLAN_SET_BLOCK_DELETE)) {
+    };
+
+    // For internal NML/CMS use only.
+    void update(CMS * cms);
+    
+    ON_OFF state; //state == ON, block delete is on, we ignore lines starting with "/"
+};
+
+class EMC_TASK_PLAN_OPTIONAL_STOP:public EMC_TASK_CMD_MSG {
+  public:
+    EMC_TASK_PLAN_OPTIONAL_STOP():EMC_TASK_CMD_MSG(EMC_TASK_PLAN_OPTIONAL_STOP_TYPE,
+					   sizeof(EMC_TASK_PLAN_OPTIONAL_STOP)) {
+    };
+
+    // For internal NML/CMS use only.
+    void update(CMS * cms);
+    
 };
 
 
@@ -1971,7 +1997,8 @@ class EMC_TASK_STAT:public EMC_TASK_STAT
     int motionLine;		// line motion is executing-- may lag
     int currentLine;		// line currently executing
     int readLine;		// line interpreter has read to
-    char optional_stop_state;	// state of optional stop (!= 0 means we stop on M1)
+    ON_OFF optional_stop_state;	// state of optional stop (== ON means we stop on M1)
+    ON_OFF block_delete_state;	// state of block delete (== ON means we ignore lines starting with "/")
     char file[LINELEN];
     char command[LINELEN];
     EmcPose origin;		// origin, in user units, currently active
Index: emc/rs274ngc/gcodemodule.cc
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/gcodemodule.cc,v
retrieving revision 1.4
diff -u -p -r1.4 gcodemodule.cc
--- emc/rs274ngc/gcodemodule.cc	3 Sep 2006 16:40:18 -0000	1.4
+++ emc/rs274ngc/gcodemodule.cc	24 Oct 2006 17:55:47 -0000
@@ -333,6 +333,7 @@ void PALLET_SHUTTLE() {}
 void CHANGE_TOOL(int tool) {}
 void SELECT_TOOL(int tool) {}
 void OPTIONAL_PROGRAM_STOP() {}
+ON_OFF GET_BLOCK_DELETE() { return 0; }
 void DISABLE_FEED_OVERRIDE() {}
 void DISABLE_SPEED_OVERRIDE() {}
 void ENABLE_FEED_OVERRIDE() {}
Index: emc/rs274ngc/interp_internal.hh
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/interp_internal.hh,v
retrieving revision 1.15
diff -u -p -r1.15 interp_internal.hh
--- emc/rs274ngc/interp_internal.hh	31 Jul 2006 02:59:34 -0000	1.15
+++ emc/rs274ngc/interp_internal.hh	24 Oct 2006 17:55:47 -0000
@@ -206,7 +206,7 @@ typedef enum
 { R_PLANE, OLD_Z }
 RETRACT_MODE;
 
-typedef int ON_OFF;
+typedef bool ON_OFF;
 
 typedef struct block_struct
 {
Index: emc/rs274ngc/interp_read.cc
===================================================================
RCS file: /cvs/emc2/src/emc/rs274ngc/interp_read.cc,v
retrieving revision 1.11
diff -u -p -r1.11 interp_read.cc
--- emc/rs274ngc/interp_read.cc	3 Jul 2006 20:36:29 -0000	1.11
+++ emc/rs274ngc/interp_read.cc	24 Oct 2006 17:55:50 -0000
@@ -2546,7 +2546,11 @@ int Interp::read_text(const char *comman
   else
     *length = strlen(line);
 
-  return ((line[0] == '/') ? INTERP_EXECUTE_FINISH : INTERP_OK);
+
+  if ((line[0] == '/') && (GET_BLOCK_DELETE() == ON)) 
+    return INTERP_EXECUTE_FINISH;
+  else
+    return INTERP_OK;
 }
 
 /****************************************************************************/
Index: emc/task/emccanon.cc
===================================================================
RCS file: /cvs/emc2/src/emc/task/emccanon.cc,v
retrieving revision 1.70
diff -u -p -r1.70 emccanon.cc
--- emc/task/emccanon.cc	17 Oct 2006 19:18:01 -0000	1.70
+++ emc/task/emccanon.cc	24 Oct 2006 17:55:53 -0000
@@ -134,8 +134,10 @@ static double spindleSpeed = 0.0;
 static int preppedTool = 0;
 
 /* optional program stop */
-static int optional_program_stop = 1; //set enabled by default (previous EMC behaviour)
+static ON_OFF optional_program_stop = ON; //set enabled by default (previous EMC behaviour)
 
+/* optional block delete */
+static ON_OFF block_delete = ON; //set enabled by default (previous EMC behaviour)
 
 /* Tool length offset is saved here */
 static double currentXToolOffset = 0.0;
@@ -1461,24 +1463,34 @@ void PROGRAM_STOP()
     interp_list.append(pauseMsg);
 }
 
-void SET_OPTIONAL_PROGRAM_STOP(char state)
+void SET_BLOCK_DELETE(ON_OFF state)
 {
+    block_delete = state; //state == ON, means we don't interpret lines starting with "/"
+}
 
-    optional_program_stop = state; //state != 0, means we stop
+ON_OFF GET_BLOCK_DELETE()
+{
+    return block_delete; //state == ON, means we  don't interpret lines starting with "/"
 }
 
-char GET_OPTIONAL_PROGRAM_STOP()
+
+void SET_OPTIONAL_PROGRAM_STOP(ON_OFF state)
 {
+    optional_program_stop = state; //state == ON, means we stop
+}
 
-    return optional_program_stop; //state != 0, means we stop
+ON_OFF GET_OPTIONAL_PROGRAM_STOP()
+{
+    return optional_program_stop; //state == ON, means we stop
 }
 
 void OPTIONAL_PROGRAM_STOP()
 {
-    if (optional_program_stop) {
-	flush_segments();
-        PROGRAM_STOP();
-    }
+    EMC_TASK_PLAN_OPTIONAL_STOP stopMsg;
+
+    flush_segments();
+
+    interp_list.append(stopMsg);
 }
 
 void PROGRAM_END()
Index: emc/task/emctask.cc
===================================================================
RCS file: /cvs/emc2/src/emc/task/emctask.cc,v
retrieving revision 1.19
diff -u -p -r1.19 emctask.cc
--- emc/task/emctask.cc	8 Sep 2006 22:30:29 -0000	1.19
+++ emc/task/emctask.cc	24 Oct 2006 17:55:53 -0000
@@ -324,12 +324,17 @@ int emcTaskPlanClearWait()
     return 0;
 }
 
-int emcTaskPlanSetOptionalStop(char state)
+int emcTaskPlanSetOptionalStop(ON_OFF state)
 {
     SET_OPTIONAL_PROGRAM_STOP(state);
     return 0;
 }
 
+int emcTaskPlanSetBlockDelete(ON_OFF state)
+{
+    SET_BLOCK_DELETE(state);
+    return 0;
+}
 
 int emcTaskPlanSynch()
 {
@@ -445,6 +450,9 @@ int emcTaskUpdate(EMC_TASK_STAT * stat)
     //update state of optional stop
     stat->optional_stop_state = GET_OPTIONAL_PROGRAM_STOP();
     
+    //update state of block delete
+    stat->block_delete_state = GET_BLOCK_DELETE();
+    
     stat->heartbeat++;
 
     return 0;
Index: emc/task/emctaskmain.cc
===================================================================
RCS file: /cvs/emc2/src/emc/task/emctaskmain.cc,v
retrieving revision 1.74
diff -u -p -r1.74 emctaskmain.cc
--- emc/task/emctaskmain.cc	16 Oct 2006 22:23:08 -0000	1.74
+++ emc/task/emctaskmain.cc	24 Oct 2006 17:55:56 -0000
@@ -343,6 +343,7 @@ static EMC_TASK_PLAN_RUN *run_msg;
 static EMC_TASK_PLAN_EXECUTE *execute_msg;
 static EMC_TASK_PLAN_OPEN *open_msg;
 static EMC_TASK_PLAN_SET_OPTIONAL_STOP *os_msg;
+static EMC_TASK_PLAN_SET_BLOCK_DELETE *bd_msg;
 
 // commands we compose here
 static EMC_TASK_PLAN_RUN taskPlanRunCmd;	// 16-Aug-1999 FMP
@@ -541,6 +542,7 @@ static int emcTaskPlan(void)
 	    case EMC_TASK_PLAN_INIT_TYPE:
 	    case EMC_TASK_PLAN_OPEN_TYPE:
 	    case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+	    case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
 	    case EMC_TASK_ABORT_TYPE:
 	    case EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE:
 	    case EMC_TRAJ_PROBE_TYPE:
@@ -656,6 +658,8 @@ static int emcTaskPlan(void)
 	    case EMC_TASK_PLAN_INIT_TYPE:
 	    case EMC_TASK_PLAN_SYNCH_TYPE:
 	    case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+	    case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+	    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 	    case EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE:
 	    case EMC_TRAJ_PROBE_TYPE:
 	    case EMC_TRAJ_SET_TELEOP_ENABLE_TYPE:
@@ -746,6 +750,8 @@ static int emcTaskPlan(void)
 		case EMC_TASK_PLAN_PAUSE_TYPE:
 		case EMC_TASK_PLAN_RESUME_TYPE:
 		case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+		case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+		case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 		case EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE:
 		case EMC_TRAJ_PROBE_TYPE:
 		case EMC_SET_DEBUG_TYPE:
@@ -820,6 +826,8 @@ static int emcTaskPlan(void)
 		case EMC_TASK_PLAN_PAUSE_TYPE:
 		case EMC_TASK_PLAN_RESUME_TYPE:
 		case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+		case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+		case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 		case EMC_TASK_SET_MODE_TYPE:
 		case EMC_TASK_SET_STATE_TYPE:
 		case EMC_TASK_ABORT_TYPE:
@@ -1020,6 +1028,8 @@ interpret_again:
 		case EMC_TASK_PLAN_PAUSE_TYPE:
 		case EMC_TASK_PLAN_RESUME_TYPE:
 		case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+		case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+		case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 		case EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE:
 		case EMC_TRAJ_PROBE_TYPE:
 		case EMC_SET_DEBUG_TYPE:
@@ -1079,6 +1089,8 @@ interpret_again:
 		case EMC_TASK_PLAN_PAUSE_TYPE:
 		case EMC_TASK_PLAN_RESUME_TYPE:
 		case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+		case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+		case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 		case EMC_TASK_SET_MODE_TYPE:
 		case EMC_TASK_SET_STATE_TYPE:
 		case EMC_TASK_ABORT_TYPE:
@@ -1183,7 +1195,9 @@ interpret_again:
 	    case EMC_TASK_PLAN_EXECUTE_TYPE:
 	    case EMC_TASK_PLAN_PAUSE_TYPE:
 	    case EMC_TASK_PLAN_SET_OPTIONAL_STOP_TYPE:
+	    case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
 	    case EMC_TASK_PLAN_RESUME_TYPE:
+	    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 	    case EMC_TASK_ABORT_TYPE:
 	    case EMC_TRAJ_CLEAR_PROBE_TRIPPED_FLAG_TYPE:
 	    case EMC_TRAJ_PROBE_TYPE:
@@ -1300,6 +1314,7 @@ static int emcTaskCheckPreconditions(NML
 	break;
 
     case EMC_TASK_PLAN_PAUSE_TYPE:
+    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 	/* pause on the interp list is queued, so wait until all are done */
 	return EMC_TASK_EXEC_WAITING_FOR_MOTION_AND_IO;
 	break;
@@ -1895,6 +1910,17 @@ static int emcTaskIssueCommand(NMLmsg * 
 	retval = 0;
 	break;
 
+    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
+	if (GET_OPTIONAL_PROGRAM_STOP() == ON) {
+	    emcTrajPause();
+	    if (emcStatus->task.interpState != EMC_TASK_INTERP_PAUSED) {
+		interpResumeState = emcStatus->task.interpState;
+	    }
+	    emcStatus->task.interpState = EMC_TASK_INTERP_PAUSED;
+	}
+	retval = 0;
+	break;
+
     case EMC_TASK_PLAN_RESUME_TYPE:
 	emcTrajResume();
 	emcStatus->task.interpState =
@@ -1934,6 +1960,12 @@ static int emcTaskIssueCommand(NMLmsg * 
 	retval = 0;
 	break;
 
+    case EMC_TASK_PLAN_SET_BLOCK_DELETE_TYPE:
+	bd_msg = (EMC_TASK_PLAN_SET_BLOCK_DELETE *) cmd;
+	emcTaskPlanSetBlockDelete(bd_msg->state);
+	retval = 0;
+	break;
+
      default:
 	// unrecognized command
 	if (EMC_DEBUG & EMC_DEBUG_TASK_ISSUE) {
@@ -2022,6 +2054,7 @@ static int emcTaskCheckPostconditions(NM
     case EMC_TASK_PLAN_INIT_TYPE:
     case EMC_TASK_PLAN_SYNCH_TYPE:
     case EMC_TASK_PLAN_EXECUTE_TYPE:
+    case EMC_TASK_PLAN_OPTIONAL_STOP_TYPE:
 	return EMC_TASK_EXEC_DONE;
 	break;
 
Index: emc/usr_intf/emcsh.cc
===================================================================
RCS file: /cvs/emc2/src/emc/usr_intf/emcsh.cc,v
retrieving revision 1.21
diff -u -p -r1.21 emcsh.cc
--- emc/usr_intf/emcsh.cc	7 Oct 2006 12:40:54 -0000	1.21
+++ emc/usr_intf/emcsh.cc	24 Oct 2006 17:56:00 -0000
@@ -1457,7 +1457,7 @@ static int sendProgramResume()
     return 0;
 }
 
-static int sendSetOptionalStop(char state)
+static int sendSetOptionalStop(ON_OFF state)
 {
     EMC_TASK_PLAN_SET_OPTIONAL_STOP emc_task_plan_set_optional_stop_msg;
 
Index: emc/usr_intf/halui.cc
===================================================================
RCS file: /cvs/emc2/src/emc/usr_intf/halui.cc,v
retrieving revision 1.33
diff -u -p -r1.33 halui.cc
--- emc/usr_intf/halui.cc	7 Oct 2006 12:40:55 -0000	1.33
+++ emc/usr_intf/halui.cc	24 Oct 2006 17:56:03 -0000
@@ -220,6 +220,9 @@ struct halui_str {
     hal_bit_t *program_os_on;      //pin for setting optional stop on
     hal_bit_t *program_os_off;     //pin for setting optional stop off
     hal_bit_t *program_os_is_on;   //status pin that optional stop is on
+    hal_bit_t *program_bd_on;      //pin for setting block delete on
+    hal_bit_t *program_bd_off;     //pin for setting block delete off
+    hal_bit_t *program_bd_is_on;   //status pin that block delete is on
 
     hal_s32_t *jog_wheel_counts;
     hal_u8_t *jog_wheel_axis;
@@ -298,6 +301,8 @@ struct local_halui_str {
     hal_bit_t program_step;       //pin for running one line of the program
     hal_bit_t program_os_on;      //pin for setting optional stop on
     hal_bit_t program_os_off;     //pin for setting optional stop off
+    hal_bit_t program_bd_on;      //pin for setting block delete on
+    hal_bit_t program_bd_off;     //pin for setting block delete off
 
     hal_s32_t jog_wheel_counts;
     hal_u8_t jog_wheel_axis;
@@ -712,6 +717,8 @@ int halui_hal_init(void)
     if (retval != HAL_SUCCESS) return retval;
     retval = halui_export_pin_OUT_bit(&(halui_data->program_os_is_on), "halui.program.optional-stop.is-on"); 
     if (retval != HAL_SUCCESS) return retval;
+    retval = halui_export_pin_OUT_bit(&(halui_data->program_bd_is_on), "halui.program.block-delete.is-on"); 
+    if (retval != HAL_SUCCESS) return retval;
     retval = halui_export_pin_OUT_bit(&(halui_data->spindle_is_on), "halui.spindle.is-on"); 
     if (retval != HAL_SUCCESS) return retval;
     retval = halui_export_pin_OUT_bit(&(halui_data->spindle_runs_forward), "halui.spindle.runs-forward"); 
@@ -802,6 +809,10 @@ int halui_hal_init(void)
     if (retval != HAL_SUCCESS) return retval;
     retval = halui_export_pin_IN_bit(&(halui_data->program_os_off), "halui.program.optional-stop.off"); 
     if (retval != HAL_SUCCESS) return retval;
+    retval = halui_export_pin_IN_bit(&(halui_data->program_bd_on), "halui.program.block-delete.on"); 
+    if (retval != HAL_SUCCESS) return retval;
+    retval = halui_export_pin_IN_bit(&(halui_data->program_bd_off), "halui.program.block-delete.off"); 
+    if (retval != HAL_SUCCESS) return retval;
 
     retval = halui_export_pin_IN_s32(&(halui_data->jog_wheel_counts), "halui.jog-wheel.counts");
     if (retval != HAL_SUCCESS) return retval;
@@ -1126,7 +1137,7 @@ static int sendProgramPause()
     return 0;
 }
 
-static int sendSetOptionalStop(char state)
+static int sendSetOptionalStop(ON_OFF state)
 {
     EMC_TASK_PLAN_SET_OPTIONAL_STOP emc_task_plan_set_optional_stop_msg;
 
@@ -1142,6 +1153,22 @@ static int sendSetOptionalStop(char stat
     return 0;
 }
 
+static int sendSetBlockDelete(ON_OFF state)
+{
+    EMC_TASK_PLAN_SET_BLOCK_DELETE emc_task_plan_set_block_delete_msg;
+
+    emc_task_plan_set_block_delete_msg.state = state;
+    emc_task_plan_set_block_delete_msg.serial_number = ++emcCommandSerialNumber;
+    emcCommandBuffer->write(emc_task_plan_set_block_delete_msg);
+    if (emcWaitType == EMC_WAIT_RECEIVED) {
+	return emcCommandWaitReceived(emcCommandSerialNumber);
+    } else if (emcWaitType == EMC_WAIT_DONE) {
+	return emcCommandWaitDone(emcCommandSerialNumber);
+    }
+
+    return 0;
+}
+
 
 static int sendProgramResume()
 {
@@ -1786,10 +1813,16 @@ static void check_hal_changes()
 	sendProgramPause();
 
     if (check_bit_changed(halui_data->program_os_on, &(old_halui_data.program_os_on)) != 0)
-	sendSetOptionalStop(1);
+	sendSetOptionalStop(ON);
 
     if (check_bit_changed(halui_data->program_os_off, &(old_halui_data.program_os_off)) != 0)
-	sendSetOptionalStop(0);
+	sendSetOptionalStop(OFF);
+
+    if (check_bit_changed(halui_data->program_bd_on, &(old_halui_data.program_bd_on)) != 0)
+	sendSetBlockDelete(ON);
+
+    if (check_bit_changed(halui_data->program_bd_off, &(old_halui_data.program_bd_off)) != 0)
+	sendSetBlockDelete(OFF);
 
     if (check_bit_changed(halui_data->program_resume, &(old_halui_data.program_resume)) != 0)
 	sendProgramResume();
@@ -1985,6 +2018,7 @@ static void modify_hal_pins()
                                         emcStatus->task.interpState == EMC_TASK_INTERP_WAITING;
     *(halui_data->program_is_idle) = emcStatus->task.interpState == EMC_TASK_INTERP_IDLE;
     *(halui_data->program_os_is_on) = emcStatus->task.optional_stop_state;
+    *(halui_data->program_bd_is_on) = emcStatus->task.block_delete_state;
 
     *(halui_data->fo_value) = emcStatus->motion.traj.scale; //feedoverride from 0 to 1 for 100%
     *(halui_data->so_value) = emcStatus->motion.traj.spindle_scale; //spindle-speed-override from 0 to 1 for 100%