added rampTime and made dataSet public

This commit is contained in:
Marius Eggert 2023-02-10 11:26:46 +01:00
parent 9041a3376c
commit c2079dcbba

View File

@ -54,6 +54,7 @@ enum PoolIds : lp_id_t {
SPI_TOTAL_ERRORS, SPI_TOTAL_ERRORS,
RW_SPEED, RW_SPEED,
RAMP_TIME,
}; };
enum States : uint8_t { STATE_ERROR, IDLE, COASTING, RUNNING_SPEED_STABLE, RUNNING_SPEED_CHANGING }; enum States : uint8_t { STATE_ERROR, IDLE, COASTING, RUNNING_SPEED_STABLE, RUNNING_SPEED_CHANGING };
@ -203,7 +204,7 @@ class TmDataset : public StaticLocalDataSet<TM_SET_ENTRIES> {
lp_var_t<uint32_t>(sid.objectId, PoolIds::SPI_TOTAL_ERRORS, this); lp_var_t<uint32_t>(sid.objectId, PoolIds::SPI_TOTAL_ERRORS, this);
}; };
class RwSpeedActuationSet : StaticLocalDataSet<4> { class RwSpeedActuationSet : public StaticLocalDataSet<2> {
friend class RwHandler; friend class RwHandler;
public: public:
@ -212,17 +213,25 @@ class RwSpeedActuationSet : StaticLocalDataSet<4> {
RwSpeedActuationSet(object_id_t objectId) RwSpeedActuationSet(object_id_t objectId)
: StaticLocalDataSet(sid_t(objectId, RwDefinitions::SetIds::SPEED_CMD_SET)) {} : StaticLocalDataSet(sid_t(objectId, RwDefinitions::SetIds::SPEED_CMD_SET)) {}
void setRwSpeed(int32_t rwSpeed_) { void setRwSpeed(int32_t rwSpeed_, uint16_t rampTime_) {
if (rwSpeed.value != rwSpeed_) { if (rwSpeed.value != rwSpeed_) {
rwSpeed = rwSpeed_;
}
if (rampTime.value != rampTime_) {
rampTime = rampTime_;
} }
rwSpeed = rwSpeed_;
} }
void getRwSpeed(int32_t& rwSpeed_) { rwSpeed_ = rwSpeed.value; } void getRwSpeed(int32_t& rwSpeed_, uint16_t& rampTime_) {
rwSpeed_ = rwSpeed.value;
rampTime_ = rampTime.value;
}
private: private:
lp_var_t<int32_t> rwSpeed = lp_var_t<int32_t> rwSpeed =
lp_var_t<int32_t>(sid.objectId, RwDefinitions::PoolIds::RW_SPEED, this); lp_var_t<int32_t>(sid.objectId, RwDefinitions::PoolIds::RW_SPEED, this);
lp_var_t<uint16_t> rampTime =
lp_var_t<uint16_t>(sid.objectId, RwDefinitions::PoolIds::RAMP_TIME, this);
}; };
} // namespace RwDefinitions } // namespace RwDefinitions