From 624487e5aa2c744c07dbced491a4bd90ff63bdd3 Mon Sep 17 00:00:00 2001 From: jsullivan-anl Date: Thu, 5 Oct 2006 20:25:09 +0000 Subject: [PATCH] handle controller version with STA command end-of-string bug (1.5.4) --- motorApp/NewFocusSrc/README | 5 ++++- motorApp/NewFocusSrc/drvPMNC87xx.cc | 11 ++++++++--- motorApp/NewFocusSrc/drvPMNCCom.h | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/motorApp/NewFocusSrc/README b/motorApp/NewFocusSrc/README index 4344fe7e..4bcaf1a8 100644 --- a/motorApp/NewFocusSrc/README +++ b/motorApp/NewFocusSrc/README @@ -1,6 +1,7 @@ NewFocus PicoMotor Controller (87xx) =================================== + This motorRecord driver supports the NewFocus 8750 and 8752 PicoMotor Network Controllers. 8750 - RS232 @ 19200Baud (8data, No Parity, 1stop) @@ -57,8 +58,10 @@ Other Info =================================== Test Versions: VER - 8750 - Version 1.0.13 + 8750 - Version 1.0.13 8752 - Version 1.5.0, 1.6.0 + 8752 - Version 1.5.4 (NO '>' on STA command - use '/n' for input EOS) + Detect driver types DRT Driver Type (8752 Only) diff --git a/motorApp/NewFocusSrc/drvPMNC87xx.cc b/motorApp/NewFocusSrc/drvPMNC87xx.cc index 8ee38718..0c2a7f75 100644 --- a/motorApp/NewFocusSrc/drvPMNC87xx.cc +++ b/motorApp/NewFocusSrc/drvPMNC87xx.cc @@ -318,8 +318,10 @@ STATIC int set_status(int card, int signal) sprintf(buff, READ_STATUS, driverID); pStr = cntrl->status_string[driverID]; /* STATUS command does not return a prompt - bug? */ - // recvRtn = send_recv_mess(card, buff, pStr, NL_EOS); - recvRtn = send_recv_mess(card, buff, pStr, NULL); + if (cntrl->changeEOS) + recvRtn = send_recv_mess(card, buff, pStr, NL_EOS); + else + recvRtn = send_recv_mess(card, buff, pStr, NULL); CHECKRTN; Debug(2, "set_status(): Status_string=%s\n", pStr); if (sscanf(pStr, "A%d=0x%x",&recvDriver, &recvStatus) == 2) @@ -889,7 +891,10 @@ STATIC int motor_init() return(ERROR); break; } - + + /* Check for 'STA\n' version = 1.5.4 + * because this version requires a NL input EOS on the STA command */ + cntrl->changeEOS = (*(bufptr + strlen(VER_STR) + 2) == '4') ? true : false; total_axis = 0; driverIndex = 0; diff --git a/motorApp/NewFocusSrc/drvPMNCCom.h b/motorApp/NewFocusSrc/drvPMNCCom.h index f443114c..eb8d0bbd 100644 --- a/motorApp/NewFocusSrc/drvPMNCCom.h +++ b/motorApp/NewFocusSrc/drvPMNCCom.h @@ -110,6 +110,8 @@ struct PMNCcontroller char chan_select_string[PMNC87xx_NUM_DRIVERS+1][25]; PMNC_model pmnc; /* Controller Type */ + bool changeEOS; /* Flag for controller version that does not terminate the + * STA command correctly */ struct PMD_axis axisDef[MAX_AXIS]; /* Axis definition - New Focus Driver Model and Number */ long last_position[MAX_AXIS]; /* Track last incremtal position to noMotion status */ int total_drivers; /* Count number of drivers connected to controller */