From 958abadd65e7cb02a49dbbcdae45f729794449c5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 3 Apr 2023 15:16:53 +0200 Subject: [PATCH] somethings buggy --- CHANGELOG.md | 10 +++++---- linux/acs/ImtqPollingTask.cpp | 4 +++- mission/acs/ImtqHandler.cpp | 40 +++++++++++++++++++++++------------ mission/tcs/HeaterHandler.cpp | 2 +- tmtc | 2 +- 5 files changed, 38 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 918b6534..7d80f83d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ will consitute of a breaking change warranting a new major release: - q7s-package: v2.4.0 +## Added + +- Version of thermal controller which performs basic control tasks. + ## Fixed - PTME was not reset after configuration changes. @@ -26,6 +30,8 @@ will consitute of a breaking change warranting a new major release: - Poll threshold configuration of the PTME IP core is now configurable via a parameter command and is set to 0b010 (4 polls) instead of 0b001 (1 poll) per default. +- EIVE system fallback and COM system fallback: Perform general subsystem handling first, then + event reception, and finally any new transition handling. # [v1.42.0] 2023-04-01 @@ -100,7 +106,6 @@ will consitute of a breaking change warranting a new major release: ## Added -- Version of thermal controller which performs basic control tasks. - The event `MEKF_RECOVERY` will be triggered in case the `MEKF` does manage to recover itself. - The persistent TM stores now have low priorities and behave like background threads now. This should prevent them from blocking or slowing down the system even during dumps @@ -112,8 +117,6 @@ will consitute of a breaking change warranting a new major release: ## Changed -- EIVE system fallback and COM system fallback: Perform general subsystem handling first, then - event reception, and finally any new transition handling. - Rework FSFW OSALs to properly support regular scheduling (NICE priorities) and real-time scheduling. - STR: Move datalink layer to `StrComHandler` completely. DLL is now completely hidden from @@ -137,7 +140,6 @@ will consitute of a breaking change warranting a new major release: - Bugfix for STR: Some action commands wrongfully declined. - STR: No normal command handling while a special request like an image upload is active. - RS485 data line was not enabled when the transmitter was switched on. ->>>>>>> origin/develop # [v1.39.0] 2023-03-21 diff --git a/linux/acs/ImtqPollingTask.cpp b/linux/acs/ImtqPollingTask.cpp index dc2af7dd..efa65735 100644 --- a/linux/acs/ImtqPollingTask.cpp +++ b/linux/acs/ImtqPollingTask.cpp @@ -58,6 +58,7 @@ void ImtqPollingTask::handleMeasureStep() { SerializeAdapter::serialize(&imtq::param::INTEGRATION_TIME_SELECT, cmdBuf.data() + 1, &dummy, cmdBuf.size(), SerializeIF::Endianness::LITTLE); cmdBuf[3] = currentRequest.integrationTimeSel; + cmdLen = 4; ReturnValue_t result = performI2cFullRequest(replyBuf.data(), 5); if (result != returnvalue::OK) { comStatus = imtq::STARTUP_CFG_ERROR; @@ -67,7 +68,7 @@ void ImtqPollingTask::handleMeasureStep() { comStatus = imtq::STARTUP_CFG_ERROR; } if (replyBuf[4] != currentRequest.integrationTimeSel) { - sif::error << "ImtqPollingTask: Integration time confiuration failed" << std::endl; + sif::error << "ImtqPollingTask: Integration time configuration failed" << std::endl; comStatus = imtq::STARTUP_CFG_ERROR; } currentIntegrationTimeMs = @@ -449,6 +450,7 @@ void ImtqPollingTask::clearReadFlagsWithTorque(ImtqRepliesWithTorque& replies) { ReturnValue_t ImtqPollingTask::performI2cFullRequest(uint8_t* reply, size_t replyLen) { int fd = 0; if (cmdLen == 0 or reply == nullptr) { + sif::error << "ImtqPollingTask: Command lenght is zero or reply PTR is invalid" << std::endl; return returnvalue::FAILED; } diff --git a/mission/acs/ImtqHandler.cpp b/mission/acs/ImtqHandler.cpp index e38af787..f1f1bcf6 100644 --- a/mission/acs/ImtqHandler.cpp +++ b/mission/acs/ImtqHandler.cpp @@ -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(&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; diff --git a/mission/tcs/HeaterHandler.cpp b/mission/tcs/HeaterHandler.cpp index 529fe698..4ec82c08 100644 --- a/mission/tcs/HeaterHandler.cpp +++ b/mission/tcs/HeaterHandler.cpp @@ -293,7 +293,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) { // Just waiting for the main switch being set on return; } else if (mainSwitchState == PowerSwitchIF::SWITCH_OFF or - mainSwitchState == PowerSwitchIF::SWITCH_UNKNOWN) { + mainSwitchState == PowerSwitchIF::SWITCH_UNKNOWN) { mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON); heater.mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs()); heater.waitMainSwitchOn = true; diff --git a/tmtc b/tmtc index cef8d623..b72dad49 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit cef8d623c9fa11237fc8e51e5fd4dab750a5602b +Subproject commit b72dad49a9c05a37c094a22d5fdaa15643b5ca7f