Skip to content

Commit

Permalink
command.c improve err msg for bad jog request
Browse files Browse the repository at this point in the history
ref: taskintf.cc:emcJogCont(),emcJogIncr(),emcJogAbs(),emcJogStop()
if  jjogmode ==> emcmotCommand.axis  = -1 (for a joint jog request)
if !jjogmode ==> emcmotCommand.joint = -1 (for a axis  jog request)

so detect that:
    a joint jog has been requested when current mode is teleop
or
    a axis coordinate jog has been requested when current mode is NOT teleop
and make messages less opaque

Note: maintain detection of unexpected conditions such as
      simultaneous negative axis_num *and* negative joint_num
  • Loading branch information
dngarrett committed Apr 27, 2018
1 parent 3499da2 commit 8259e14
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/emc/motion/command.c
Expand Up @@ -448,11 +448,17 @@ void emcmotCommandHandler(void *arg, long period)
|| emcmotCommand->command == EMCMOT_JOG_ABS
) {
if (GET_MOTION_TELEOP_FLAG() && axis_num < 0) {
emsg = "command.com teleop bad axis_num";
emsg = "command.com teleop: unexpected negative axis_num";
if (joint_num >= 0) {
emsg = "Mode is TELEOP, cannot jog joint";
}
abort = 1;
}
if (!GET_MOTION_TELEOP_FLAG() && joint_num < 0) {
emsg = "command.com !teleop bad joint_num";
emsg = "command.com !teleop: unexpected negative joint_num";
if (axis_num >= 0) {
emsg = "Mode is NOT TELEOP, cannot jog axis coordinate";
}
abort = 1;
}
if (GET_MOTION_TELEOP_FLAG()) {
Expand All @@ -468,16 +474,13 @@ void emcmotCommandHandler(void *arg, long period)
if (abort) {
switch (emcmotCommand->command) {
case EMCMOT_JOG_CONT:
rtapi_print_msg(RTAPI_MSG_ERR,"JOG_CONT %s cmd=%d\n",
emsg,emcmotCommand->command);
rtapi_print_msg(RTAPI_MSG_ERR,"JOG_CONT %s\n",emsg);
break;
case EMCMOT_JOG_INCR:
rtapi_print_msg(RTAPI_MSG_ERR,"JOG_INCR %s cmd=%d\n",
emsg,emcmotCommand->command);
rtapi_print_msg(RTAPI_MSG_ERR,"JOG_INCR %s\n",emsg);
break;
case EMCMOT_JOG_ABS:
rtapi_print_msg(RTAPI_MSG_ERR,"JOG_ABS %s cmd=%d\n",
emsg,emcmotCommand->command);
rtapi_print_msg(RTAPI_MSG_ERR,"JOG_ABS %s\n",emsg);
break;
default: break;
}
Expand Down

0 comments on commit 8259e14

Please sign in to comment.