From a507efb309fa3b07c0258131d65f2304d7ff4988 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Wed, 26 Mar 2014 20:52:14 +0000 Subject: [PATCH] Fixes to build valid trajectory files on Windows and for new XPS-Q8 controller; improve error handling in buildProfile --- motorApp/NewportSrc/XPSController.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/motorApp/NewportSrc/XPSController.cpp b/motorApp/NewportSrc/XPSController.cpp index 1e8bb611..07e6c113 100644 --- a/motorApp/NewportSrc/XPSController.cpp +++ b/motorApp/NewportSrc/XPSController.cpp @@ -590,7 +590,7 @@ asynStatus XPSController::buildProfile() } /* Create the profile file */ - trajFile = fopen(fileName, "w"); + trajFile = fopen(fileName, "wb"); if (trajFile == 0) { buildOK = false; status = -1; @@ -641,7 +641,6 @@ asynStatus XPSController::buildProfile() if (!inGroup[j]) continue; fprintf(trajFile,", %f, %f", pAxes_[j]->profilePostDistance_, 0.); } - fprintf(trajFile,"\n"); fclose (trajFile); /* FTP the trajectory file from the local directory to the XPS */ @@ -696,6 +695,7 @@ asynStatus XPSController::buildProfile() sprintf(message, "Unknown trajectory verify error=%d", status); break; } + if (!verifyOK) goto done; /* Read dynamic parameters*/ for (j=0; jpositionerName_, status); + goto done; } // Don't do the rest if the axis is not being used if (!useAxis[j]) continue; @@ -729,12 +730,14 @@ asynStatus XPSController::buildProfile() verifyOK = false; sprintf(message, "Low soft limit violation for axis %s, position=%f, limit=%f\n", pAxes_[j]->positionerName_, minProfile, lowLimit); + goto done; } maxProfile = pAxes_[j]->profilePositions_[0] + maxPositionActual; if (maxProfile > highLimit) { verifyOK = false; sprintf(message, "High soft limit violation for axis %s, position=%f, limit=%f\n", pAxes_[j]->positionerName_, maxProfile, highLimit); + goto done; } } done: