done
All checks were successful
EIVE/eive-obsw/pipeline/pr-v2.1.0-dev This commit looks good

This commit is contained in:
Robin Müller 2023-05-12 17:39:15 +02:00
parent 714e2d07e5
commit a718d182fc
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 6 additions and 7 deletions

View File

@ -105,6 +105,7 @@ void PlocMPSoCHandler::performOperationHook() {
ReturnValue_t PlocMPSoCHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
ReturnValue_t result = returnvalue::OK;
commandIsPending = true;
switch (actionId) {
case mpsoc::SET_UART_TX_TRISTATE: {
uartIsolatorSwitch.pullLow();
@ -225,9 +226,9 @@ void PlocMPSoCHandler::doShutDown() {
}
ReturnValue_t PlocMPSoCHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
if (not commandIsExecuting(mpsoc::TC_GET_HK_REPORT)) {
if (not commandIsPending) {
*id = mpsoc::TC_GET_HK_REPORT;
// normalCmdPending = true;
commandIsPending = true;
return buildCommandFromCommand(*id, nullptr, 0);
}
return NOTHING_TO_SEND;
@ -378,7 +379,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
};
switch (apid) {
case (mpsoc::apid::ACK_SUCCESS):
sif::debug << "recv ack" << std::endl;
*foundLen = mpsoc::SIZE_ACK_REPORT;
*foundId = mpsoc::ACK_REPORT;
break;
@ -394,7 +394,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT);
break;
case (mpsoc::apid::TM_HK_GET_REPORT): {
sif::debug << "recv hk report" << std::endl;
handleDedicatedReply(mpsoc::TM_GET_HK_REPORT);
break;
}
@ -403,7 +402,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
break;
}
case (mpsoc::apid::EXE_SUCCESS):
sif::debug << "recv exe" << std::endl;
*foundLen = mpsoc::SIZE_EXE_REPORT;
*foundId = mpsoc::EXE_REPORT;
break;
@ -419,12 +417,11 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain
}
}
uint16_t recvSeqCnt = (*(start + 2) << 8 | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
uint16_t recvSeqCnt = ((*(start + 2) << 8) | *(start + 3)) & PACKET_SEQUENCE_COUNT_MASK;
if (recvSeqCnt != sequenceCount) {
triggerEvent(MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH, sequenceCount, recvSeqCnt);
sequenceCount = recvSeqCnt;
}
sif::debug << "sequence count: " << sequenceCount.get() << std::endl;
// This sequence count ping pong does not make any sense but it is how the MPSoC expects it.
sequenceCount++;
return result;
@ -809,6 +806,7 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) {
if (normalCmdPending) {
normalCmdPending = false;
}
commandIsPending = false;
auto commandIter = deviceCommandMap.find(getPendingCommand());
if (commandIter != deviceCommandMap.end()) {
commandIter->second.isExecuting = false;

View File

@ -169,6 +169,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
// Used to block incoming commands when MPSoC helper class is currently executing a command
bool plocMPSoCHelperExecuting = false;
bool commandIsPending = false;
struct TmMemReadReport {
static const uint8_t FIX_SIZE = 14;