From 57bb03280cdf41d7117ee7d62f271c3cb6aa896e Mon Sep 17 00:00:00 2001 From: motorapp Date: Wed, 29 Jun 2016 22:59:59 +1000 Subject: [PATCH] Fixed issue in programUpload method Limit update period to 200ms maximum --- 3-3/GalilSup/src/GalilController.cpp | 14 +++++++++++++- 3-3/GalilSup/src/GalilController.h | 1 + 3-3/iocBoot/iocGalil/galil.cmd | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/3-3/GalilSup/src/GalilController.cpp b/3-3/GalilSup/src/GalilController.cpp index 30332a1..c8b9372 100644 --- a/3-3/GalilSup/src/GalilController.cpp +++ b/3-3/GalilSup/src/GalilController.cpp @@ -173,6 +173,9 @@ // Stop on motor inhibit now uses limit deceleration // Fixed axis speed change on stop // Removed display code parameter from GalilStartController +// 29/06/16 M.Clift +// Fixed issue in programUpload method +// Limit update period to 200ms maximum #include #include @@ -295,6 +298,7 @@ GalilController::GalilController(const char *portName, const char *address, doub numAxes_(0), unsolicitedQueue_(MAX_GALIL_AXES, MAX_GALIL_STRING_SIZE) { struct Galilmotor_enables *motor_enables = NULL; //Convenience pointer to GalilController motor_enables[digport] + char mesg[MAX_GALIL_STRING_SIZE]; //Connected mesg unsigned i; // Create controller-specific parameters @@ -430,6 +434,13 @@ GalilController::GalilController(const char *portName, const char *address, doub code_assembled_ = false; //We have not recieved a timeout yet consecutive_timeouts_ = 0; + //Parse update period + if (fabs(updatePeriod) > MAX_UPDATE_PERIOD) + { + sprintf(mesg, "Limiting UpdatePeriod to %dms maximum, ignoring specified updatePeriod", MAX_UPDATE_PERIOD); + setCtrlError(mesg); + updatePeriod = (updatePeriod < 0) ? -MAX_UPDATE_PERIOD : MAX_UPDATE_PERIOD; + } //Store period in ms between data records updatePeriod_ = fabs(updatePeriod); //Assume sync tcp mode will be used for now @@ -4358,7 +4369,8 @@ asynStatus GalilController::programUpload(string *prog) //Search for terminating : character for (i = 0; i < nread; i++) { - done = (buf[i] == ':') ? true : false; + if (i > 0) + done = (buf[i-1] == 26 && buf[i] == ':') ? true : false; if (done) break; //Upload complete } diff --git a/3-3/GalilSup/src/GalilController.h b/3-3/GalilSup/src/GalilController.h index 189430f..0a599e3 100644 --- a/3-3/GalilSup/src/GalilController.h +++ b/3-3/GalilSup/src/GalilController.h @@ -33,6 +33,7 @@ #define SCALCARGS 16 //Number of communication retries #define ALLOWED_TIMEOUTS 2 +#define MAX_UPDATE_PERIOD 200 #define MAX_GALIL_UNSOLICTED_SIZE 29 #define MAX_GALIL_STRING_SIZE 768 #define MAX_GALIL_DATAREC_SIZE 768 diff --git a/3-3/iocBoot/iocGalil/galil.cmd b/3-3/iocBoot/iocGalil/galil.cmd index 06f0d17..bafa022 100755 --- a/3-3/iocBoot/iocGalil/galil.cmd +++ b/3-3/iocBoot/iocGalil/galil.cmd @@ -33,7 +33,8 @@ dbLoadTemplate("$(TOP)/GalilTestApp/Db/galil_profileMoveAxis.substitutions") # # 1. Const char *portName - The name of the asyn port that will be created for this controller # 2. Const char *address - The address of the controller -# 3. double updatePeriod - The time in ms between datarecords 2ms minimum. Async if controller + bus supports it, otherwise is polled/synchronous. +# 3. double updatePeriod - The time in ms between datarecords 2ms min, 200ms max. Async if controller + bus supports it, otherwise is polled/synchronous. +# - Recommend 50ms or less for ethernet # - Specify negative updatePeriod < 0 to force synchronous tcp poll period. Otherwise will try async udp mode first # Create a Galil controller