Skip to content

Commit

Permalink
Fixed issue in programUpload method
Browse files Browse the repository at this point in the history
Limit update period to 200ms maximum
  • Loading branch information
motorapp authored and motorapp committed Jun 29, 2016
1 parent a096345 commit 57bb032
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion 3-3/GalilSup/src/GalilController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdio.h>
#include <math.h>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions 3-3/GalilSup/src/GalilController.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion 3-3/iocBoot/iocGalil/galil.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 57bb032

Please sign in to comment.