more bugfixes
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-11-21 17:20:41 +01:00
parent b1ddf1d4fd
commit 1176c4397d
2 changed files with 15 additions and 10 deletions

View File

@ -8,7 +8,9 @@
#include "eive/definitions.h" #include "eive/definitions.h"
#include "eive/objects.h" #include "eive/objects.h"
#include "fsfw/action.h"
#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/globalfunctions/arrayprinter.h"
#include "fsfw/ipc/CommandMessage.h"
#include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/ipc/QueueFactory.h" #include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManagerIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h"
@ -78,6 +80,7 @@ void FreshSupvHandler::performDeviceOperation(uint8_t opCode) {
buildActiveCmdKey(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT))); buildActiveCmdKey(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT)));
if (cmdIter == activeActionCmds.end() or not cmdIter->second.isPending) { if (cmdIter == activeActionCmds.end() or not cmdIter->second.isPending) {
spParams.buf = commandBuffer.data(); spParams.buf = commandBuffer.data();
commandedByCached = MessageQueueIF::NO_QUEUE;
sendEmptyCmd(supv::GET_HK_REPORT, Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT), sendEmptyCmd(supv::GET_HK_REPORT, Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT),
true); true);
} }
@ -200,7 +203,7 @@ ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueI
using namespace supv; using namespace supv;
// The SUPV does not have any action commands where there is no communication with the device // The SUPV does not have any action commands where there is no communication with the device
// involved. // involved.
if(mode != MODE_ON and mode != MODE_NORMAL) { if (mode != MODE_ON and mode != MODE_NORMAL) {
return HasModesIF::INVALID_MODE; return HasModesIF::INVALID_MODE;
} }
ReturnValue_t result; ReturnValue_t result;
@ -392,6 +395,9 @@ ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueI
result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
break; break;
} }
if (result == returnvalue::OK) {
this->commandedByCached = commandedBy;
}
return result; return result;
} }
@ -538,9 +544,6 @@ void FreshSupvHandler::handleTransitionToOff() {
ReturnValue_t FreshSupvHandler::sendCommand(DeviceCommandId_t commandId, TcBase& tc, ReturnValue_t FreshSupvHandler::sendCommand(DeviceCommandId_t commandId, TcBase& tc,
bool replyExpected, uint32_t cmdCountdownMs) { bool replyExpected, uint32_t cmdCountdownMs) {
if (interCmdCd.isBusy()) {
TaskFactory::delayTask(interCmdCd.getRemainingMillis());
}
if (supv::DEBUG_PLOC_SUPV) { if (supv::DEBUG_PLOC_SUPV) {
if (not(supv::REDUCE_NORMAL_MODE_PRINTOUT and mode == MODE_NORMAL and if (not(supv::REDUCE_NORMAL_MODE_PRINTOUT and mode == MODE_NORMAL and
commandId == supv::GET_HK_REPORT)) { commandId == supv::GET_HK_REPORT)) {
@ -555,6 +558,7 @@ ReturnValue_t FreshSupvHandler::sendCommand(DeviceCommandId_t commandId, TcBase&
if (activeCmdIter == activeActionCmds.end()) { if (activeCmdIter == activeActionCmds.end()) {
info.isPending = true; info.isPending = true;
info.replyPacketExpected = replyExpected; info.replyPacketExpected = replyExpected;
info.commandedBy = commandedByCached;
activeActionCmds.emplace(buildActiveCmdKey(tc.getModuleApid(), tc.getServiceId()), info); activeActionCmds.emplace(buildActiveCmdKey(tc.getModuleApid(), tc.getServiceId()), info);
} else { } else {
if (activeCmdIter->second.isPending) { if (activeCmdIter->second.isPending) {
@ -562,6 +566,7 @@ ReturnValue_t FreshSupvHandler::sendCommand(DeviceCommandId_t commandId, TcBase&
} }
activeCmdIter->second.isPending = true; activeCmdIter->second.isPending = true;
activeCmdIter->second.commandId = commandId; activeCmdIter->second.commandId = commandId;
activeCmdIter->second.commandedBy = commandedByCached;
activeCmdIter->second.ackRecv = false; activeCmdIter->second.ackRecv = false;
activeCmdIter->second.ackExeRecv = false; activeCmdIter->second.ackExeRecv = false;
activeCmdIter->second.replyPacketExpected = replyExpected; activeCmdIter->second.replyPacketExpected = replyExpected;
@ -571,7 +576,6 @@ ReturnValue_t FreshSupvHandler::sendCommand(DeviceCommandId_t commandId, TcBase&
} }
ReturnValue_t result = ReturnValue_t result =
uartManager->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen()); uartManager->sendMessage(comCookie, tc.getFullPacket(), tc.getFullPacketLen());
interCmdCd.resetTimer();
return result; return result;
} }
@ -1099,10 +1103,10 @@ void FreshSupvHandler::handleEvent(EventMessage* eventMessage) {
event == PlocSupvUartManager::SUPV_CONTINUE_UPDATE_SUCCESSFUL || event == PlocSupvUartManager::SUPV_CONTINUE_UPDATE_SUCCESSFUL ||
event == PlocSupvUartManager::SUPV_MEM_CHECK_FAIL || event == PlocSupvUartManager::SUPV_MEM_CHECK_FAIL ||
event == PlocSupvUartManager::SUPV_MEM_CHECK_OK) { event == PlocSupvUartManager::SUPV_MEM_CHECK_OK) {
// Wait for a short period for the uart state machine to adjust
// TaskFactory::delayTask(5);
if (not isCommandAlreadyActive(supv::SHUTDOWN_MPSOC)) { if (not isCommandAlreadyActive(supv::SHUTDOWN_MPSOC)) {
result = this->executeAction(supv::SHUTDOWN_MPSOC, MessageQueueIF::NO_QUEUE, nullptr, 0); CommandMessage actionMsg;
ActionMessage::setCommand(&actionMsg, supv::SHUTDOWN_MPSOC, store_address_t::invalid());
result = messageQueue->sendMessage(getCommandQueue(), &actionMsg);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
triggerEvent(supv::SUPV_MPSOC_SHUTDOWN_BUILD_FAILED); triggerEvent(supv::SUPV_MPSOC_SHUTDOWN_BUILD_FAILED);
sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown " sif::warning << "PlocSupervisorHandler::handleEvent: Failed to build MPSoC shutdown "

View File

@ -14,7 +14,7 @@
using supv::TcBase; using supv::TcBase;
static constexpr bool DEBUG_PLOC_SUPV = false; static constexpr bool DEBUG_PLOC_SUPV = true;
static constexpr bool REDUCE_NORMAL_MODE_PRINTOUT = true; static constexpr bool REDUCE_NORMAL_MODE_PRINTOUT = true;
class FreshSupvHandler : public FreshDeviceHandlerBase { class FreshSupvHandler : public FreshDeviceHandlerBase {
@ -101,7 +101,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
Countdown switchTimeout = Countdown(2000); Countdown switchTimeout = Countdown(2000);
// Vorago nees some time to boot properly // Vorago nees some time to boot properly
Countdown bootTimeout = Countdown(supv::BOOT_TIMEOUT_MS); Countdown bootTimeout = Countdown(supv::BOOT_TIMEOUT_MS);
Countdown interCmdCd = Countdown(supv::INTER_COMMAND_DELAY); // Countdown interCmdCd = Countdown(supv::INTER_COMMAND_DELAY);
PoolEntry<uint16_t> adcRawEntry = PoolEntry<uint16_t>(16); PoolEntry<uint16_t> adcRawEntry = PoolEntry<uint16_t>(16);
PoolEntry<uint16_t> adcEngEntry = PoolEntry<uint16_t>(16); PoolEntry<uint16_t> adcEngEntry = PoolEntry<uint16_t>(16);
@ -136,6 +136,7 @@ class FreshSupvHandler : public FreshDeviceHandlerBase {
std::array<uint8_t, supv::MAX_COMMAND_SIZE> commandBuffer{}; std::array<uint8_t, supv::MAX_COMMAND_SIZE> commandBuffer{};
SpacePacketCreator creator; SpacePacketCreator creator;
supv::TcParams spParams = supv::TcParams(creator); supv::TcParams spParams = supv::TcParams(creator);
DeviceCommandId_t commandedByCached = MessageQueueIF::NO_QUEUE;
ReturnValue_t parseTmPackets(); ReturnValue_t parseTmPackets();