Skip to content

Commit 7428898

Browse files
committed
motion.c: Improve handling of misc_error pin names
See #2780 And #2773 Also document the use of names_misc_errors
1 parent a27fab3 commit 7428898

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

docs/man/man9/motion.9

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
motion \- accepts NML motion commands, interacts with HAL in realtime
55

66
.SH SYNOPSIS
7-
\fBloadrt motmod [base_period_nsec=\fIperiod\fB] [base_thread_fp=\fI0 or 1\fB] [servo_period_nsec=\fIperiod\fB] [traj_period_nsec=\fIperiod\fB] [num_joints=\fI[1-16]\fB] [num_dio=\fI[1-64]\fB] [num_aio=\fI[1-64]\fB] [num_misc_error=\fI[0-64]\fB] [num_spindles=\fI[1-8]\fB]\fR \fB[unlock_joints_mask=\fR\fIjointmask\fR\fB]\fR \fB[num_extrajoints=\fI[0-16]\fB]\fR
7+
\fBloadrt motmod [base_period_nsec=\fIperiod\fB] [base_thread_fp=\fI0 or 1\fB] [servo_period_nsec=\fIperiod\fB] [traj_period_nsec=\fIperiod\fB] [num_joints=\fI[1-16]\fB] [num_dio=\fI[1-64]\fB] [num_aio=\fI[1-64]\fB] [num_misc_error=\fI[0-64]\fB | names_misc_errors] [num_spindles=\fI[1-8]\fB]\fR \fB[unlock_joints_mask=\fR\fIjointmask\fR\fB]\fR \fB[num_extrajoints=\fI[0-16]\fB]\fR
88

99
The limits for the following items are compile-time settings:
1010
.br
@@ -26,6 +26,13 @@ The limits for the following items are compile-time settings:
2626
.br
2727
.ns
2828
.TP
29+
\fBnames_misc_errors\fR: A comma-separated list of names for extra error inputs.
30+
This parameter is mutually exclusive with num_misc_error.
31+
If using num_misc_error the additional error input pins will have names like \fBmotion.misc-error-00\fR whereas \fBnames_misc_errors=overtemp,undertemp\fR will
32+
create hal pins \fBmotion.err-overtemp\fR and \fBmotion.err-undertemp\fR
33+
.br
34+
.ns
35+
.TP
2936
\fBnum_spindles\fR: Maximum number of spindles is set by EMCMOT_MAX_SPINDLES
3037

3138
.P

src/emc/motion/motion.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static char *names_ain[MAX_IO] = {0,};
7272
RTAPI_MP_ARRAY_STRING(names_ain, MAX_IO, "names of analog inputs");
7373
static char *names_aout[MAX_IO] = {0,};
7474
RTAPI_MP_ARRAY_STRING(names_aout, MAX_IO, "names of analog outputs");
75-
static int num_misc_error = DEFAULT_MISC_ERROR; /* default number of misc errors */
75+
static int num_misc_error = -1; /* To check use of num_misc_error modparam */
7676
RTAPI_MP_INT(num_misc_error, "number of misc error inputs");
7777

7878
static char *names_misc_errors[MAX_IO] = {0,};
@@ -341,15 +341,14 @@ int rtapi_app_main(void)
341341
return -1;
342342
}
343343

344-
if(num_misc_error && (names_misc_errors[0])){
344+
if(num_misc_error != -1 && (names_misc_errors[0])){
345345
rtapi_print_msg(RTAPI_MSG_ERR, _("MOTION: Can't specify both names and number for misc error\n"));
346346
return -1;
347347
}
348348
else if(names_misc_errors[0]){
349-
num_misc_error = count_names(names_dout);
350-
num_misc_error = (num_misc_error > count_names(names_din)) ? num_misc_error : count_names(names_din);
349+
num_misc_error = count_names(names_misc_errors);
351350
}
352-
else if(!num_misc_error){
351+
else {
353352
num_misc_error = DEFAULT_MISC_ERROR;
354353
}
355354

0 commit comments

Comments
 (0)