@@ -86,6 +86,15 @@ static double *pcmd_p[EMCMOT_MAX_AXIS];
8686*/
8787static void process_inputs (void );
8888
89+ /* 'joint_jog_abort_all()' if either jog-stop or jog-stop-immediate
90+ become True while jogging then the jog will abort.
91+ jog-stop will stop the active jog following the associated
92+ acceleration values.
93+ jog-stop-immediate will immediately stop jogging (potentially
94+ causing joint following errors).
95+ */
96+ static void joint_jog_abort_all (bool immediate );
97+
8998/* 'do forward kins()' takes the position feedback in joint coords
9099 and applies the forward kinematics to it to generate feedback
91100 in Cartesean coordinates. It has code to handle machines that
@@ -529,24 +538,30 @@ static void process_inputs(void)
529538 }
530539 }
531540 }
532- // if jog in progress
533- if (enables & * (emcmot_hal_data -> jog_inhibit ) && * (emcmot_hal_data -> jog_is_active )) {
534- // stop any joint jog
535- int jNum ;
536- for (jNum = 0 ; jNum < NO_OF_KINS_JOINTS ; jNum ++ ) {
537- joint = & joints [jNum ];
538- if (joint -> kb_jjog_active || joint -> wheel_jjog_active ) {
539- joint -> free_tp .enable = 0 ;
540- joint -> free_tp .curr_vel = 0.0 ;
541- joint -> kb_jjog_active = 0 ;
542- joint -> wheel_jjog_active = 0 ;
543- }
541+ // if jog in progress stop the jog if requested
542+ if (enables & * (emcmot_hal_data -> jog_is_active ) && (* (emcmot_hal_data -> jog_stop ) || * (emcmot_hal_data -> jog_stop_immediate ))) {
543+ joint_jog_abort_all (* (emcmot_hal_data -> jog_stop_immediate ));
544+ axis_jog_abort_all (* (emcmot_hal_data -> jog_stop_immediate ));
545+ if (* (emcmot_hal_data -> jog_stop_immediate )) {
546+ reportError ("Jog aborted by jog-stop-immediate" );
547+ } else {
548+ reportError ("Jog aborted by jog-stop" );
544549 }
545- // stop any axis jog
546- axis_jog_inhibit_all ();
550+ }
551+ }
547552
548- * (emcmot_hal_data -> jog_is_active ) = 0 ;
549- reportError ("Jog aborted by jog-inhibit" );
553+ static void joint_jog_abort_all (bool immediate )
554+ {
555+ int jNum ;
556+ emcmot_joint_t * joint ;
557+ for (jNum = 0 ; jNum < NO_OF_KINS_JOINTS ; jNum ++ ) {
558+ joint = & joints [jNum ];
559+ joint -> free_tp .enable = 0 ;
560+ joint -> kb_jjog_active = 0 ;
561+ joint -> wheel_jjog_active = 0 ;
562+ if (immediate ) {
563+ joint -> free_tp .curr_vel = 0.0 ;
564+ }
550565 }
551566}
552567
@@ -733,7 +748,7 @@ static void process_probe_inputs(void)
733748 if (!aborted ) aborted = 2 ;
734749 }
735750 }
736- if (axis_jog_immediate_stop_all ( )) {
751+ if (axis_jog_abort_all ( 1 )) {
737752 aborted = 3 ;
738753 }
739754
@@ -858,7 +873,7 @@ static void set_operating_mode(void)
858873 we just went into disabled state */
859874 }
860875
861- axis_jog_immediate_stop_all ( );
876+ axis_jog_abort_all ( 1 );
862877
863878 SET_MOTION_ENABLE_FLAG (0 );
864879 /* don't clear the motion error flag, since that may signify why we
@@ -1301,7 +1316,7 @@ static void get_pos_cmds(long period)
13011316 break ;
13021317
13031318 case EMCMOT_MOTION_COORD :
1304- axis_jog_immediate_stop_all ( );
1319+ axis_jog_abort_all ( 1 );
13051320
13061321 /* check joint 0 to see if the interpolators are empty */
13071322 coord_cubic_active = 1 ;
@@ -1512,7 +1527,7 @@ static void get_pos_cmds(long period)
15121527 && GET_MOTION_TELEOP_FLAG ()
15131528 && emcmotStatus -> on_soft_limit ) {
15141529 SET_MOTION_ERROR_FLAG (1 );
1515- axis_jog_immediate_stop_all ( );
1530+ axis_jog_abort_all ( 1 );
15161531 }
15171532 if (ext_offset_teleop_limit || ext_offset_coord_limit ) {
15181533 * (emcmot_hal_data -> eoffset_limited ) = 1 ;
@@ -1810,7 +1825,6 @@ static void output_to_hal(void)
18101825 joint_hal_t * joint_data ;
18111826 static int old_motion_index [EMCMOT_MAX_SPINDLES ] = {0 };
18121827 static int old_hal_index [EMCMOT_MAX_SPINDLES ] = {0 };
1813- bool activeJog = 0 ;
18141828
18151829 /* output machine info to HAL for scoping, etc */
18161830 * (emcmot_hal_data -> motion_enabled ) = GET_MOTION_ENABLE_FLAG ();
@@ -2015,17 +2029,12 @@ static void output_to_hal(void)
20152029 + joint -> motor_offset ;
20162030 continue ;
20172031 }
2018- // joint jog is in progress
2019- if (joint -> kb_jjog_active || joint -> wheel_jjog_active ) {
2020- activeJog = 1 ;
2021- }
20222032 } // for joint_num
20232033
20242034 axis_output_to_hal (pcmd_p );
2025- if (axis_jog_is_active ()) {
2026- activeJog = 1 ;
2027- }
2028- * (emcmot_hal_data -> jog_is_active ) = activeJog ;
2035+
2036+ * (emcmot_hal_data -> jog_is_active ) = axis_jog_is_active () || joint_jog_is_active ();
2037+
20292038}
20302039
20312040static void update_status (void )
@@ -2110,6 +2119,8 @@ static void update_status(void)
21102119 emcmotStatus -> misc_error [misc_error ] = * (emcmot_hal_data -> misc_error [misc_error ]);
21112120 }
21122121
2122+ emcmotStatus -> jogging_active = * (emcmot_hal_data -> jog_is_active );
2123+
21132124 /*! \todo FIXME - the rest of this function is stuff that was apparently
21142125 dropped in the initial move from emcmot.c to control.c. I
21152126 don't know how much is still needed, and how much is baggage.
@@ -2125,8 +2136,6 @@ static void update_status(void)
21252136 emcmotStatus -> motionType = tpGetMotionType (& emcmotInternal -> coord_tp );
21262137 emcmotStatus -> queueFull = tcqFull (& emcmotInternal -> coord_tp .queue );
21272138
2128- emcmotStatus -> jogging_active = axis_jog_is_active ()
2129- || joint_jog_is_active ();
21302139 /* check to see if we should pause in order to implement
21312140 single emcmotStatus->stepping */
21322141
0 commit comments