From fcfbc92bab8bfd2d8749982e5c0258e9c256e986 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Tue, 10 Dec 2013 17:30:08 +0000 Subject: [PATCH] Print error if unable to create trajectory file; changed waitMotors to use GroupStatusGet, because pAxis->poll won't ever get response back, it did not issue command for profileMove --- motorApp/NewportSrc/XPSController.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/motorApp/NewportSrc/XPSController.cpp b/motorApp/NewportSrc/XPSController.cpp index 75586902..62cea308 100644 --- a/motorApp/NewportSrc/XPSController.cpp +++ b/motorApp/NewportSrc/XPSController.cpp @@ -448,15 +448,16 @@ XPSAxis* XPSController::getAxis(int axisNo) asynStatus XPSController::waitMotors() { - bool moving, anyMoving=true; - int j; + int groupStatus; + int status; + char groupName[MAX_GROUPNAME_LEN]; + + getStringParam(XPSProfileGroupName_, (int)sizeof(groupName), groupName); - while (anyMoving) { - anyMoving = false; - for (j=0; jpoll(&moving); - if (moving) anyMoving = true; - } + while (1) { + status = GroupStatusGet(pollSocket_, groupName, &groupStatus); + if (status) return asynError; + if (groupStatus >= 10 && groupStatus <= 18) break; epicsThreadSleep(0.1); } return asynSuccess; @@ -585,6 +586,12 @@ asynStatus XPSController::buildProfile() /* Create the profile file */ trajFile = fopen(fileName, "w"); + if (trajFile == 0) { + buildOK = false; + status = -1; + sprintf(message, "Error creating trajectory file %s, error=%s\n", fileName, strerror(errno)); + goto done; + } /* Create the initial acceleration element */ fprintf(trajFile,"%f", preTimeMax); @@ -654,7 +661,7 @@ asynStatus XPSController::buildProfile() status = ftpDisconnect(ftpSocket); if (status) { buildOK = false; - sprintf(message, "Error calling ftpDisconnect, status=%d\n", status); + sprintf(message, "Error calling ftpDisconnect, status=%d\n", status); goto done; }