somethings buggy
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2023-04-03 15:16:53 +02:00
parent fba856a9a9
commit 958abadd65
5 changed files with 38 additions and 20 deletions

View File

@ -151,19 +151,25 @@ void ImtqHandler::doStartUp() {
}
void ImtqHandler::doShutDown() {
updatePeriodicReply(false, imtq::cmdIds::REPLY_NO_TORQUE);
updatePeriodicReply(false, imtq::cmdIds::REPLY_WITH_TORQUE);
specialRequestActive = false;
firstReplyCycle = true;
internalState = InternalState::NONE;
commandExecuted = false;
statusSet.setValidity(false, true);
rawMtmNoTorque.setValidity(false, true);
rawMtmWithTorque.setValidity(false, true);
hkDatasetNoTorque.setValidity(false, true);
hkDatasetWithTorque.setValidity(false, true);
calMtmMeasurementSet.setValidity(false, true);
setMode(_MODE_POWER_DOWN);
if (internalState != InternalState::SHUTDOWN) {
commandExecuted = false;
internalState = InternalState::SHUTDOWN;
}
if (internalState == InternalState::SHUTDOWN and commandExecuted) {
updatePeriodicReply(false, imtq::cmdIds::REPLY_NO_TORQUE);
updatePeriodicReply(false, imtq::cmdIds::REPLY_WITH_TORQUE);
specialRequestActive = false;
firstReplyCycle = true;
internalState = InternalState::NONE;
commandExecuted = false;
statusSet.setValidity(false, true);
rawMtmNoTorque.setValidity(false, true);
rawMtmWithTorque.setValidity(false, true);
hkDatasetNoTorque.setValidity(false, true);
hkDatasetWithTorque.setValidity(false, true);
calMtmMeasurementSet.setValidity(false, true);
setMode(_MODE_POWER_DOWN);
}
}
ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
@ -243,6 +249,11 @@ ReturnValue_t ImtqHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
// 6 ms integration time instead of 10 ms.
request.integrationTimeSel = 2;
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
if (internalState == InternalState::SHUTDOWN) {
request.mode = acs::SimpleSensorMode::OFF;
} else {
request.mode = acs::SimpleSensorMode::NORMAL;
}
rawPacket = reinterpret_cast<uint8_t*>(&request);
rawPacketLen = sizeof(imtq::Request);
return returnvalue::OK;
@ -311,6 +322,9 @@ ReturnValue_t ImtqHandler::scanForReply(const uint8_t* start, size_t remainingSi
if (getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON or getMode() == _MODE_POWER_DOWN) {
return IGNORE_FULL_PACKET;
}
if (internalState == InternalState::SHUTDOWN) {
commandExecuted = true;
}
if (remainingSize > 0) {
*foundLen = remainingSize;
*foundId = expectedReply;