This commit is contained in:
@ -11,7 +11,6 @@ RwHandler::RwHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCooki
|
||||
: DeviceHandlerBase(objectId, comIF, comCookie),
|
||||
gpioComIF(gpioComIF),
|
||||
enableGpio(enableGpio),
|
||||
temperatureSet(this),
|
||||
statusSet(this),
|
||||
lastResetStatusSet(this),
|
||||
tmDataset(this) {
|
||||
@ -134,7 +133,7 @@ void RwHandler::fillCommandAndReplyMap() {
|
||||
RwDefinitions::SIZE_GET_RW_STATUS);
|
||||
this->insertInCommandAndReplyMap(RwDefinitions::INIT_RW_CONTROLLER, 1, nullptr,
|
||||
RwDefinitions::SIZE_INIT_RW);
|
||||
this->insertInCommandAndReplyMap(RwDefinitions::GET_TEMPERATURE, 1, &temperatureSet,
|
||||
this->insertInCommandAndReplyMap(RwDefinitions::GET_TEMPERATURE, 1, nullptr,
|
||||
RwDefinitions::SIZE_GET_TEMPERATURE_REPLY);
|
||||
this->insertInCommandAndReplyMap(RwDefinitions::SET_SPEED, 1, nullptr,
|
||||
RwDefinitions::SIZE_SET_SPEED_REPLY);
|
||||
@ -278,7 +277,6 @@ ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataP
|
||||
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
|
||||
poolManager.subscribeForPeriodicPacket(temperatureSet.getSid(), false, 30.0, false);
|
||||
poolManager.subscribeForPeriodicPacket(statusSet.getSid(), false, 5.0, true);
|
||||
poolManager.subscribeForPeriodicPacket(tmDataset.getSid(), false, 30.0, false);
|
||||
return RETURN_OK;
|
||||
@ -354,17 +352,28 @@ void RwHandler::handleResetStatusReply(const uint8_t* packet) {
|
||||
}
|
||||
|
||||
void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
|
||||
PoolReadGuard rg(&statusSet);
|
||||
PoolReadGuard rg0(&statusSet);
|
||||
PoolReadGuard rg1(&tmDataset);
|
||||
uint8_t offset = 2;
|
||||
statusSet.currSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
||||
*(packet + offset + 1) << 8 | *(packet + offset);
|
||||
tmDataset.rwCurrSpeed = statusSet.currSpeed;
|
||||
tmDataset.rwCurrSpeed.setValid(true);
|
||||
offset += 4;
|
||||
statusSet.referenceSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
||||
*(packet + offset + 1) << 8 | *(packet + offset);
|
||||
tmDataset.rwRefSpeed = statusSet.referenceSpeed;
|
||||
tmDataset.rwRefSpeed.setValid(true);
|
||||
offset += 4;
|
||||
statusSet.state = *(packet + offset);
|
||||
tmDataset.rwState = statusSet.state;
|
||||
tmDataset.rwState.setValid(true);
|
||||
offset += 1;
|
||||
statusSet.clcMode = *(packet + offset);
|
||||
tmDataset.rwClcMode = statusSet.clcMode;
|
||||
tmDataset.rwClcMode.setValid(true);
|
||||
|
||||
statusSet.setValidity(true, true);
|
||||
|
||||
if (statusSet.state == RwDefinitions::STATE_ERROR) {
|
||||
// This requires the commanding of the init reaction wheel controller command to recover
|
||||
@ -388,14 +397,14 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
|
||||
}
|
||||
|
||||
void RwHandler::handleTemperatureReply(const uint8_t* packet) {
|
||||
PoolReadGuard rg(&temperatureSet);
|
||||
PoolReadGuard rg(&statusSet);
|
||||
uint8_t offset = 2;
|
||||
temperatureSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
||||
*(packet + offset + 1) << 8 | *(packet + offset);
|
||||
statusSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
||||
*(packet + offset + 1) << 8 | *(packet + offset);
|
||||
if (debugMode) {
|
||||
#if OBSW_VERBOSE_LEVEL >= 1
|
||||
sif::info << "RwHandler::handleTemperatureReply: Temperature: "
|
||||
<< temperatureSet.temperatureCelcius << " °C" << std::endl;
|
||||
sif::info << "RwHandler::handleTemperatureReply: Temperature: " << statusSet.temperatureCelcius
|
||||
<< " °C" << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user