Ready for release 1.0

This commit is contained in:
2025-05-23 12:29:30 +02:00
parent d1d694ad6b
commit deb6e6996e
4 changed files with 62 additions and 148 deletions

View File

@ -119,7 +119,7 @@ masterMacsAxis::masterMacsAxis(masterMacsController *pC, int axisNo)
// Collect all axes into this list which will be used in the hook function
axes.push_back(this);
pMasterMacsA_ = std::make_unique<masterMaxsAxisImpl>((masterMacsAxisImpl){
pMasterMacsA_ = std::make_unique<masterMacsAxisImpl>((masterMacsAxisImpl){
.axisStatus = std::bitset<16>(0),
.axisError = std::bitset<16>(0),
.lastSetSpeed = 0.0,
@ -845,7 +845,7 @@ asynStatus masterMacsAxis::doMove(double position, int relative,
// motor speed changed since the last move command.
if (motorCanSetSpeed != 0 && pMasterMacsA_->lastSetSpeed != motorVelocity) {
lastSetSpeed_ = motorVelocity;
pMasterMacsA_->lastSetSpeed = motorVelocity;
snprintf(value, sizeof(value), "%lf", motorVelocity);
rw_status = pC_->write(axisNo_, 05, value);
@ -1195,6 +1195,17 @@ asynStatus masterMacsAxis::enable(bool on) {
return asynError;
}
bool masterMacsAxis::needInit() { return pMasterMacsA_->needInit; }
/**
* @brief Instruct the axis to run its init() function during the next poll
*
* @param needInit
*/
void masterMacsAxis::setNeedInit(bool needInit) {
pMasterMacsA_->needInit = needInit;
}
/**
Convert a float to an unint16_t bitset
*/
@ -1249,169 +1260,77 @@ asynStatus masterMacsAxis::readAxisError() {
return rw_status;
}
asynStatus readConfig();
bool masterMacsAxis::readyToBeSwitchedOn() {
return pMasterMacsA_->axisStatus[0];
}
/**
* @brief Read the Master MACS status with the xR10 command and store the
* result in pMasterMacsA_->axisStatus
*
*/
asynStatus readAxisStatus();
bool masterMacsAxis::switchedOn() { return pMasterMacsA_->axisStatus[1]; }
/*
The functions below read the specified status bit from the
pMasterMacsA_->axisStatus bitset. Since a bit can either be 0 or 1, the return
value is given as a boolean.
*/
bool masterMacsAxis::faultConditionSet() {
return pMasterMacsA_->axisStatus[3];
}
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool readyToBeSwitchedOn() { return pMasterMacsA_->axisStatus[0]; }
bool masterMacsAxis::voltagePresent() { return pMasterMacsA_->axisStatus[4]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool switchedOn() { return pMasterMacsA_->axisStatus[1]; }
bool masterMacsAxis::quickStopping() {
return pMasterMacsA_->axisStatus[5] == 0;
}
// Bit 2 is unused
bool masterMacsAxis::switchOnDisabled() { return pMasterMacsA_->axisStatus[6]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool faultConditionSet() { return pMasterMacsA_->axisStatus[3]; }
bool masterMacsAxis::warning() { return pMasterMacsA_->axisStatus[7]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool voltagePresent() { return pMasterMacsA_->axisStatus[4]; }
bool masterMacsAxis::remoteMode() { return pMasterMacsA_->axisStatus[9]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool quickStopping() { return pMasterMacsA_->axisStatus[5] == 0; }
bool masterMacsAxis::targetReached() { return pMasterMacsA_->axisStatus[10]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool switchOnDisabled() { return pMasterMacsA_->axisStatus[6]; }
bool masterMacsAxis::internalLimitActive() {
return pMasterMacsA_->axisStatus[11];
}
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool warning() { return pMasterMacsA_->axisStatus[7]; }
bool masterMacsAxis::setEventHasOcurred() {
return pMasterMacsA_->axisStatus[14];
}
// Bit 8 is unused
bool masterMacsAxis::powerEnabled() { return pMasterMacsA_->axisStatus[15]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool remoteMode() { return pMasterMacsA_->axisStatus[9]; }
bool masterMacsAxis::shortCircuit() { return pMasterMacsA_->axisError[1]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool targetReached() { return pMasterMacsA_->axisStatus[10]; }
bool masterMacsAxis::encoderError() { return pMasterMacsA_->axisError[2]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool internalLimitActive() { return pMasterMacsA_->axisStatus[11]; }
bool masterMacsAxis::followingError() { return pMasterMacsA_->axisError[3]; }
// Bits 12 and 13 are unused
bool masterMacsAxis::communicationError() {
return pMasterMacsA_->axisError[4];
}
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool setEventHasOcurred() { return pMasterMacsA_->axisStatus[14]; }
bool masterMacsAxis::feedbackError() { return pMasterMacsA_->axisError[5]; }
/**
* @brief Read the property from pMasterMacsA_->axisStatus
*/
bool powerEnabled() { return pMasterMacsA_->axisStatus[15]; }
bool masterMacsAxis::positiveLimitSwitch() {
return pMasterMacsA_->axisError[6];
}
/**
* @brief Read the Master MACS status with the xR10 command and store the
* result in pMasterMacsA_->axisStatus
*
*/
asynStatus readAxisError();
bool masterMacsAxis::negativeLimitSwitch() {
return pMasterMacsA_->axisError[7];
}
/*
The functions below read the specified error bit from the
pMasterMacsA_->axisError bitset. Since a bit can either be 0 or 1, the return
value is given as a boolean.
*/
bool masterMacsAxis::positiveSoftwareLimit() {
return pMasterMacsA_->axisError[8];
}
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool shortCircuit() { return pMasterMacsA_->axisError[1]; }
bool masterMacsAxis::negativeSoftwareLimit() {
return pMasterMacsA_->axisError[9];
}
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool encoderError() { return pMasterMacsA_->axisError[2]; }
bool masterMacsAxis::overCurrent() { return pMasterMacsA_->axisError[10]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool followingError() { return pMasterMacsA_->axisError[3]; }
bool masterMacsAxis::overTemperature() { return pMasterMacsA_->axisError[11]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool communicationError() { return pMasterMacsA_->axisError[4]; }
bool masterMacsAxis::overVoltage() { return pMasterMacsA_->axisError[12]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool feedbackError() { return pMasterMacsA_->axisError[5]; }
bool masterMacsAxis::underVoltage() { return pMasterMacsA_->axisError[13]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool positiveLimitSwitch() { return pMasterMacsA_->axisError[6]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool negativeLimitSwitch() { return pMasterMacsA_->axisError[7]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool positiveSoftwareLimit() { return pMasterMacsA_->axisError[8]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool negativeSoftwareLimit() { return pMasterMacsA_->axisError[9]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool overCurrent() { return pMasterMacsA_->axisError[10]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool overTemperature() { return pMasterMacsA_->axisError[11]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool overVoltage() { return pMasterMacsA_->axisError[12]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool underVoltage() { return pMasterMacsA_->axisError[13]; }
/**
* @brief Read the property from pMasterMacsA_->axisError
*/
bool stoFault() { return pMasterMacsA_->axisError[15]; }
bool masterMacsAxis::stoFault() { return pMasterMacsA_->axisError[15]; }
/***************************************************************************/
/** The following functions are C-wrappers, and can be called directly from

View File

@ -8,7 +8,7 @@
// https://en.cppreference.com/w/cpp/language/class.
class masterMacsController;
struct masterMaxsAxisImpl;
struct masterMacsAxisImpl;
class masterMacsAxis : public sinqAxis {
public:
@ -288,7 +288,7 @@ class masterMacsAxis : public sinqAxis {
private:
masterMacsController *pC_;
std::unique_ptr<masterMaxsAxisImpl> pMasterMacsA_;
std::unique_ptr<masterMacsAxisImpl> pMasterMacsA_;
};
#endif

View File

@ -16,11 +16,6 @@ struct masterMacsControllerImpl {
double comTimeout;
};
/*
Stores the constructor input comTimeout
*/
double;
/**
* @brief Copy src into dst and replace all NULL terminators up to the carriage
* return with spaces. This allows to print *dst with asynPrint.