Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions GalilSup/src/GalilAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ GalilAxis::GalilAxis(class GalilController *pC, //Pointer to controller instance
int switch_type) //motor enable/disable switch type
: asynMotorAxis(pC, (toupper(axisname[0]) - AASCII)),
pC_(pC), last_encoder_position_(0), smoothed_encoder_position_(0), encoder_smooth_factor_(0.0), motor_dly_(0.0),
first_poll_(true),encDirOk_(true), pollRequest_(10, sizeof(int))
first_poll_(true),encDirOk_(true), last_done_(1), pollRequest_(10, sizeof(int))
{
string limit_code; //Code generated for limits interrupt on this axis
string digital_code; //Code generated for digital interrupt related to this axis
Expand Down Expand Up @@ -2180,7 +2180,7 @@ void GalilAxis::checkHoming(void)

// ISIS: need to confirm limits high/low limit behaviour
bool home_timeout = homing_ && (stoppedTime_ >= homing_timeout) && !cancelHomeSent_;
bool home_soft_limits_hit = (((readback > highLimit_ && softlimits) || (readback < lowLimit_ && softlimits)) && homing_ && !cancelHomeSent_ && done_);
bool home_soft_limits_hit = (((readback > highLimit_ && softlimits) || (readback < lowLimit_ && softlimits)) && home_timeout && done_);
if (home_timeout || home_soft_limits_hit)
{
sprintf(pC_->cmd_, "MG homed%c\n", axisName_);
Expand Down Expand Up @@ -2976,7 +2976,10 @@ asynStatus GalilAxis::poller(bool& moving)

//Extract axis motion data from controller datarecord, and load into GalilAxis instance
status |= getStatus();
if (status) goto skip;
if (status) {
done_ = last_done_;
goto skip;
}

//Set poll variables in GalilAxis based on data record info
setStatus(&moving);
Expand Down Expand Up @@ -3046,7 +3049,6 @@ asynStatus GalilAxis::poller(bool& moving)
smoothed_encoder_position_ = (1.0 - encoder_smooth_factor_) * encoder_position_ +
encoder_smooth_factor_ * smoothed_encoder_position_;
}
skip:
//Save encoder position, and done for next poll cycle
last_encoder_position_ = encoder_position_;
last_done_ = done_;
Expand All @@ -3056,7 +3058,7 @@ asynStatus GalilAxis::poller(bool& moving)
//By this driver during homing
revlast_ = rev_;
fwdlast_ = fwd_;

skip:
//Set status
if (encoder_smooth_factor_ != 0.0)
{
Expand Down
2 changes: 2 additions & 0 deletions GalilSup/src/GalilConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ void GalilConnector::run(void)
//Check GalilController for response
//Test synchronous communication
//Query controller for synchronous connection handle
strcpy(pC_->cmd_, "EO 0"); // first we also turn off echo mode as it really breaks things
pC_->sync_writeReadController();
strcpy(pC_->cmd_, "WH");
sync_status = pC_->sync_writeReadController(true);
//Store the handle controller used for sync
Expand Down
Loading