Fixed bug in enable method and adjusted PowerCycleTimeout value
This commit is contained in:
@@ -38,7 +38,7 @@ A special communication timeout is used in the following two cases:
|
||||
2) First move command after enabling the motor
|
||||
This is due to MasterMACS running a powerup cycle, which can delay the answer.
|
||||
*/
|
||||
#define PowerCycleTimeout 10.0 // Value in seconds
|
||||
#define PowerCycleTimeout 6.0 // Value in seconds
|
||||
|
||||
/*
|
||||
Contains all instances of turboPmacAxis which have been created and is used in
|
||||
@@ -1119,7 +1119,6 @@ asynStatus masterMacsAxis::readEncoderType() {
|
||||
|
||||
asynStatus masterMacsAxis::enable(bool on) {
|
||||
|
||||
int timeout_enable_disable = 2;
|
||||
char msg[pC_->MAXBUF_];
|
||||
|
||||
// =========================================================================
|
||||
@@ -1177,8 +1176,7 @@ asynStatus masterMacsAxis::enable(bool on) {
|
||||
// hence we wait for a custom timespan in seconds instead of
|
||||
// pC_->comTimeout_
|
||||
double timeout = pC_->comTimeout();
|
||||
if (pMasterMacsA_->targetReachedUninitialized &&
|
||||
timeout < PowerCycleTimeout) {
|
||||
if (timeout < PowerCycleTimeout) {
|
||||
timeout = PowerCycleTimeout;
|
||||
}
|
||||
|
||||
@@ -1190,7 +1188,7 @@ asynStatus masterMacsAxis::enable(bool on) {
|
||||
// Query the axis status every few milliseconds until the axis has been
|
||||
// enabled or until the timeout has been reached
|
||||
int startTime = time(NULL);
|
||||
while (time(NULL) < startTime + timeout_enable_disable) {
|
||||
while (time(NULL) < startTime + PowerCycleTimeout) {
|
||||
|
||||
// Read the axis status
|
||||
usleep(100000);
|
||||
|
||||
Reference in New Issue
Block a user