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

View File

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