Skip to content

Commit

Permalink
Merge branch '2.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
andypugh committed Sep 24, 2023
2 parents 4cae01e + c568d03 commit 1f8db91
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/hal/drivers/mesa-hostmot2/abs_encoder.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@


//
// Driver for the Mesa SSI Encoder module.
// It is expected that it will be expanded to cover BISS and Fanuc absolute
// encoders in the future.
// Driver for the Mesa Absolute Encoder modules.
//


Expand Down Expand Up @@ -271,7 +267,8 @@ int hm2_absenc_parse_format(hm2_sserial_remote_t *chan, hm2_absenc_format_t *de
conf->ParmAddr = 0;
conf->Flags = 0;
// Modifier flags
while (strchr("gGmM", *format)){
// 24/9/23 atp - string literal has a terminating \0 but we want 0 to fail
while ( *format && strchr("gGmM", *format)){
if (*format=='g' || *format=='G'){
conf->Flags |= 0x01;
format++;
Expand Down Expand Up @@ -331,8 +328,8 @@ int hm2_absenc_parse_format(hm2_sserial_remote_t *chan, hm2_absenc_format_t *de
conf->ParmMin = 0;
break;
default:
HM2_ERR_NO_LL("The \"g\" and \"m\"format modifiers must be"
"paired with one of the other data types\n");
HM2_ERR_NO_LL("The \"g\" and \"m\" format modifiers must be"
" paired with one of the other data types\n");
return -EINVAL;
}

Expand Down Expand Up @@ -389,7 +386,7 @@ int hm2_absenc_parse_md(hostmot2_t *hm2, int md_index) {
// looks good (so far), start initializing
//

if (hm2->absenc.num_chans) { // first time though
if (hm2->absenc.num_chans == 0) { // first time though
hm2->absenc.clock_frequency = md->clock_freq;
hm2->absenc.ssi_busy_flags = rtapi_kmalloc(sizeof(rtapi_u32), RTAPI_GFP_KERNEL);
*hm2->absenc.ssi_busy_flags = 0;
Expand Down Expand Up @@ -422,7 +419,7 @@ int hm2_absenc_parse_md(hostmot2_t *hm2, int md_index) {
memset(chan, 0, sizeof(hm2_sserial_remote_t));
chan->index = index;
chan->myinst = md->gtag;

if (hm2_absenc_parse_format(chan, def) ) goto fail1;

switch (md->gtag){
Expand Down Expand Up @@ -482,7 +479,6 @@ int hm2_absenc_parse_md(hostmot2_t *hm2, int md_index) {
}
}
}

return hm2->absenc.num_chans;

fail1:
Expand Down

0 comments on commit 1f8db91

Please sign in to comment.