4141// note:the +1 is for the PROGRAM_PREFIX or default directory==nc_files
4242
4343/* flag for how we want to interpret traj coord mode, as mdi or auto */
44- static int mdiOrAuto = EMC_TASK_MODE_AUTO ;
44+ static EMC_TASK_MODE mdiOrAuto = EMC_TASK_MODE::AUTO ;
4545
4646InterpBase *pinterp=0 ;
4747#define interp (*pinterp)
@@ -219,7 +219,7 @@ int emcTaskStateRestore()
219219{
220220 int res = 0 ;
221221 // Do NOT restore on MDI command
222- if (emcStatus->task .mode == EMC_TASK_MODE_AUTO ) {
222+ if (emcStatus->task .mode == EMC_TASK_MODE::AUTO ) {
223223 // Validity of state tag checked within restore function
224224 res = pinterp->restore_from_tag (emcStatus->motion .traj .tag );
225225 }
@@ -235,8 +235,8 @@ int emcTaskAbort()
235235 interp_list.clear ();
236236
237237 // clear out the interpreter state
238- emcStatus->task .interpState = EMC_TASK_INTERP_IDLE ;
239- emcStatus->task .execState = EMC_TASK_EXEC_DONE ;
238+ emcStatus->task .interpState = EMC_TASK_INTERP::IDLE ;
239+ emcStatus->task .execState = EMC_TASK_EXEC::DONE ;
240240 emcStatus->task .task_paused = 0 ;
241241 emcStatus->task .motionLine = 0 ;
242242 emcStatus->task .readLine = 0 ;
@@ -265,7 +265,7 @@ int emcTaskAbort()
265265 return 0 ;
266266}
267267
268- int emcTaskSetMode (int mode)
268+ int emcTaskSetMode (EMC_TASK_MODE mode)
269269{
270270 int retval = 0 ;
271271
@@ -275,30 +275,30 @@ int emcTaskSetMode(int mode)
275275 }
276276
277277 switch (mode) {
278- case EMC_TASK_MODE_MANUAL :
278+ case EMC_TASK_MODE::MANUAL :
279279 // go to manual mode
280280 if (all_homed ()) {
281- emcTrajSetMode (EMC_TRAJ_MODE_TELEOP );
281+ emcTrajSetMode (EMC_TRAJ_MODE::TELEOP );
282282 } else {
283- emcTrajSetMode (EMC_TRAJ_MODE_FREE );
283+ emcTrajSetMode (EMC_TRAJ_MODE::FREE );
284284 }
285- mdiOrAuto = EMC_TASK_MODE_AUTO ; // we'll default back to here
285+ mdiOrAuto = EMC_TASK_MODE::AUTO ; // we'll default back to here
286286 break ;
287287
288- case EMC_TASK_MODE_MDI :
288+ case EMC_TASK_MODE::MDI :
289289 // go to mdi mode
290- emcTrajSetMode (EMC_TRAJ_MODE_COORD );
290+ emcTrajSetMode (EMC_TRAJ_MODE::COORD );
291291 emcTaskAbort ();
292292 emcTaskPlanSynch ();
293- mdiOrAuto = EMC_TASK_MODE_MDI ;
293+ mdiOrAuto = EMC_TASK_MODE::MDI ;
294294 break ;
295295
296- case EMC_TASK_MODE_AUTO :
296+ case EMC_TASK_MODE::AUTO :
297297 // go to auto mode
298- emcTrajSetMode (EMC_TRAJ_MODE_COORD );
298+ emcTrajSetMode (EMC_TRAJ_MODE::COORD );
299299 emcTaskAbort ();
300300 emcTaskPlanSynch ();
301- mdiOrAuto = EMC_TASK_MODE_AUTO ;
301+ mdiOrAuto = EMC_TASK_MODE::AUTO ;
302302 break ;
303303
304304 default :
@@ -309,13 +309,13 @@ int emcTaskSetMode(int mode)
309309 return retval;
310310}
311311
312- int emcTaskSetState (int state)
312+ int emcTaskSetState (EMC_TASK_STATE state)
313313{
314314 int t;
315315 int retval = 0 ;
316316
317317 switch (state) {
318- case EMC_TASK_STATE_OFF :
318+ case EMC_TASK_STATE::OFF :
319319 emcMotionAbort ();
320320 // turn the machine servos off-- go into READY state
321321 for (t = 0 ; t < emcStatus->motion .traj .spindles ; t++) emcSpindleAbort (t);
@@ -331,7 +331,7 @@ int emcTaskSetState(int state)
331331 emcTaskPlanSynch ();
332332 break ;
333333
334- case EMC_TASK_STATE_ON :
334+ case EMC_TASK_STATE::ON :
335335 // turn the machine servos on
336336 emcTrajEnable ();
337337 for (t = 0 ; t < emcStatus->motion .traj .joints ; t++){
@@ -340,7 +340,7 @@ int emcTaskSetState(int state)
340340 emcLubeOn ();
341341 break ;
342342
343- case EMC_TASK_STATE_ESTOP_RESET :
343+ case EMC_TASK_STATE::ESTOP_RESET :
344344 // reset the estop
345345 emcAuxEstopOff ();
346346 emcLubeOff ();
@@ -351,7 +351,7 @@ int emcTaskSetState(int state)
351351 emcTaskPlanSynch ();
352352 break ;
353353
354- case EMC_TASK_STATE_ESTOP :
354+ case EMC_TASK_STATE::ESTOP :
355355 emcMotionAbort ();
356356 for (t = 0 ; t < emcStatus->motion .traj .spindles ; t++) emcSpindleAbort (t);
357357 // go into estop-- do both IO estop and machine servos off
@@ -393,15 +393,15 @@ int emcTaskSetState(int state)
393393 COORD MDI MDI
394394 COORD AUTO AUTO
395395 */
396- static int determineMode ()
396+ EMC_TASK_MODE determineMode ()
397397{
398- if (emcStatus->motion .traj .mode == EMC_TRAJ_MODE_FREE ) {
399- return EMC_TASK_MODE_MANUAL ;
398+ if (emcStatus->motion .traj .mode == EMC_TRAJ_MODE::FREE ) {
399+ return EMC_TASK_MODE::MANUAL ;
400400 }
401- if (emcStatus->motion .traj .mode == EMC_TRAJ_MODE_TELEOP ) {
402- return EMC_TASK_MODE_MANUAL ;
401+ if (emcStatus->motion .traj .mode == EMC_TRAJ_MODE::TELEOP ) {
402+ return EMC_TASK_MODE::MANUAL ;
403403 }
404- // for EMC_TRAJ_MODE_COORD
404+ // for EMC_TRAJ_MODE::COORD
405405 return mdiOrAuto;
406406}
407407
@@ -419,17 +419,17 @@ static int determineMode()
419419 DISABLED OUT OF ESTOP ESTOP_RESET
420420 ENABLED OUT OF ESTOP ON
421421 */
422- static int determineState ()
422+ static EMC_TASK_STATE determineState ()
423423{
424424 if (emcStatus->io .aux .estop ) {
425- return EMC_TASK_STATE_ESTOP ;
425+ return EMC_TASK_STATE::ESTOP ;
426426 }
427427
428428 if (!emcStatus->motion .traj .enabled ) {
429- return EMC_TASK_STATE_ESTOP_RESET ;
429+ return EMC_TASK_STATE::ESTOP_RESET ;
430430 }
431431
432- return EMC_TASK_STATE_ON ;
432+ return EMC_TASK_STATE::ON ;
433433}
434434
435435static int waitFlag = 0 ;
@@ -692,11 +692,11 @@ int emcTaskPlanCommand(char *cmd)
692692
693693int emcTaskUpdate (EMC_TASK_STAT * stat)
694694{
695- stat->mode = ( enum EMC_TASK_MODE_ENUM) determineMode ();
696- int oldstate = stat->state ;
697- stat->state = ( enum EMC_TASK_STATE_ENUM) determineState ();
695+ stat->mode = determineMode ();
696+ EMC_TASK_STATE oldstate = stat->state ;
697+ stat->state = determineState ();
698698
699- if (oldstate == EMC_TASK_STATE_ON && oldstate != stat->state ) {
699+ if (oldstate == EMC_TASK_STATE::ON && oldstate != stat->state ) {
700700 emcTaskAbort ();
701701 for (int s = 0 ; s < emcStatus->motion .traj .spindles ; s++) emcSpindleAbort (s);
702702 emcIoAbort (EMC_ABORT_TASK_STATE_NOT_ON);
@@ -718,15 +718,15 @@ int emcTaskUpdate(EMC_TASK_STAT * stat)
718718 // update active G and M codes
719719 // Start by assuming that we can't unpack a state tag from motion
720720 int res_state = INTERP_ERROR;
721- if (emcStatus->task .interpState != EMC_TASK_INTERP_IDLE ) {
721+ if (emcStatus->task .interpState != EMC_TASK_INTERP::IDLE ) {
722722 res_state = interp.active_modes (&stat->activeGCodes [0 ],
723723 &stat->activeMCodes [0 ],
724724 &stat->activeSettings [0 ],
725725 emcStatus->motion .traj .tag );
726726 }
727727 // If we get an error from trying to unpack from the motion state, always
728728 // use interp's internal state, so the active state is never out of date
729- if (emcStatus->task .mode != EMC_TASK_MODE_AUTO ||
729+ if (emcStatus->task .mode != EMC_TASK_MODE::AUTO ||
730730 res_state == INTERP_ERROR) {
731731 interp.active_g_codes (&stat->activeGCodes [0 ]);
732732 interp.active_m_codes (&stat->activeMCodes [0 ]);
0 commit comments