MPSoC Fixes #894

Merged
muellerr merged 4 commits from mpsoc-fixes into main 2024-05-13 14:03:12 +02:00
4 changed files with 29 additions and 7 deletions

View File

@ -16,7 +16,14 @@ will consitute of a breaking change warranting a new major release:
# [unreleased] # [unreleased]
# [v8.0.0] # [v8.0.1] 2024-05-08
## Fixed
- MPSoC normal mode: Do not command periodically while a special COM operation is ongoing.
- Possible fix for file read algorithm.
# [v8.0.0] 2024-05-06
- `eive-tmtc` v7.0.0 - `eive-tmtc` v7.0.0

View File

@ -86,7 +86,7 @@ void FreshMpsocHandler::performDefaultDeviceOperation() {
// We checked the action queue beforehand, so action commands should always be performed // We checked the action queue beforehand, so action commands should always be performed
// before normal commands. // before normal commands.
if (mode == MODE_NORMAL and not activeCmdInfo.pending) { if (mode == MODE_NORMAL and not activeCmdInfo.pending and not specialComHelperExecuting) {
ReturnValue_t result = commandTcGetHkReport(); ReturnValue_t result = commandTcGetHkReport();
if (result == returnvalue::OK) { if (result == returnvalue::OK) {
commandInitHandling(mpsoc::TC_GET_HK_REPORT, MessageQueueIF::NO_QUEUE); commandInitHandling(mpsoc::TC_GET_HK_REPORT, MessageQueueIF::NO_QUEUE);
@ -337,6 +337,10 @@ void FreshMpsocHandler::startTransition(Mode_t newMode, Submode_t submode) {
} else if ((newMode == MODE_ON or newMode == MODE_NORMAL) && } else if ((newMode == MODE_ON or newMode == MODE_NORMAL) &&
((mode == MODE_OFF) or (mode == MODE_UNDEFINED))) { ((mode == MODE_OFF) or (mode == MODE_UNDEFINED))) {
transitionState = TransitionState::TO_ON; transitionState = TransitionState::TO_ON;
} else if (mode == MODE_ON && newMode == MODE_NORMAL) {
hkReport.setReportingEnabled(true);
} else if (mode == MODE_NORMAL && newMode == MODE_ON) {
hkReport.setReportingEnabled(false);
} else if (newMode == MODE_OFF) { } else if (newMode == MODE_OFF) {
transitionState = TransitionState::TO_OFF; transitionState = TransitionState::TO_OFF;
} }
@ -372,7 +376,9 @@ void FreshMpsocHandler::handleTransitionToOn() {
if (startupState == StartupState::DONE) { if (startupState == StartupState::DONE) {
setMode(targetMode, targetSubmode); setMode(targetMode, targetSubmode);
transitionState = TransitionState::NONE; transitionState = TransitionState::NONE;
if (targetMode == MODE_NORMAL) {
hkReport.setReportingEnabled(true); hkReport.setReportingEnabled(true);
}
powerState = PowerState::IDLE; powerState = PowerState::IDLE;
startupState = StartupState::IDLE; startupState = StartupState::IDLE;
} }
@ -803,6 +809,11 @@ ReturnValue_t FreshMpsocHandler::commandTcModeSnapshot() {
ReturnValue_t FreshMpsocHandler::finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase, ReturnValue_t FreshMpsocHandler::finishAndSendTc(DeviceCommandId_t cmdId, mpsoc::TcBase& tcBase,
uint32_t cmdCountdownMs) { uint32_t cmdCountdownMs) {
// Emit warning but still send command.
if (specialComHelperExecuting) {
sif::warning << "PLOC MPSoC: Sending command even though special COM helper is executing"
<< std::endl;
}
ReturnValue_t result = tcBase.finishPacket(); ReturnValue_t result = tcBase.finishPacket();
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;

View File

@ -179,8 +179,12 @@ ReturnValue_t PlocMpsocSpecialComHelper::performFlashWrite() {
ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() { ReturnValue_t PlocMpsocSpecialComHelper::performFlashRead() {
std::error_code e; std::error_code e;
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::trunc | std::ios::binary); if (std::filesystem::exists(flashReadAndWrite.obcFile)) {
if (ofile.bad()) { // Truncate the file first.
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::binary | std::ios::trunc);
}
std::ofstream ofile(flashReadAndWrite.obcFile, std::ios::binary | std::ios::app);
if (ofile.bad() or not ofile.is_open()) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ); ReturnValue_t result = flashfopen(mpsoc::FileAccessModes::READ);

2
tmtc

@ -1 +1 @@
Subproject commit 9a06c64dfac3f4283c2d5af72a9c095f4726480b Subproject commit 067a0160405bcf53659072749eddbb7ad7f1d41c