what is going on with that thing?
EIVE/eive-obsw/pipeline/pr-main This commit looks good Details

This commit is contained in:
Robin Müller 2023-11-08 18:43:11 +01:00
parent d8e0f9ffce
commit 6ae9e12cf9
1 changed files with 22 additions and 12 deletions

View File

@ -61,13 +61,17 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
}
void PlocSupervisorHandler::performOperationHook() {
if(normalCommandIsPending and normalCmdCd.hasTimedOut()) {
if (normalCommandIsPending and normalCmdCd.hasTimedOut()) {
// Event, FDIR, printout? Leads to spam though and normally should not happen..
normalCommandIsPending = false;
}
if(commandIsPending and cmdCd.hasTimedOut()) {
if (commandIsPending and cmdCd.hasTimedOut()) {
// Event, FDIR, printout? Leads to spam though and normally should not happen..
commandIsPending = false;
// if(iter->second.sendReplyTo != NO_COMMANDER) {
// actionHelper.finish(true, iter->second.sendReplyTo, iter->first, returnvalue::OK);
// }
disableAllReplies();
}
EventMessage event;
@ -181,6 +185,7 @@ void PlocSupervisorHandler::doShutDown() {
nextReplyId = supv::NONE;
uartManager.stop();
uartIsolatorSwitch.pullLow();
disableAllReplies();
supv::SUPV_ON = false;
startupState = StartupState::OFF;
}
@ -348,6 +353,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
break;
}
commandIsPending = true;
cmdCd.resetTimer();
return result;
}
@ -625,8 +631,8 @@ void PlocSupervisorHandler::handlePacketPrint() {
if (result != returnvalue::OK) {
sif::warning << "PlocSupervisorHandler: Parsing ACK failed" << std::endl;
}
if (REDUCE_NORMAL_MODE_PRINTOUT and ack.getRefModuleApid() == (uint8_t) supv::Apid::HK and
ack.getRefServiceId() == (uint8_t) supv::tc::HkId::GET_REPORT) {
if (REDUCE_NORMAL_MODE_PRINTOUT and ack.getRefModuleApid() == (uint8_t)supv::Apid::HK and
ack.getRefServiceId() == (uint8_t)supv::tc::HkId::GET_REPORT) {
return;
}
const char* printStr = "???";
@ -648,8 +654,8 @@ void PlocSupervisorHandler::handlePacketPrint() {
sif::warning << "PlocSupervisorHandler: Parsing EXE failed" << std::endl;
}
const char* printStr = "???";
if (REDUCE_NORMAL_MODE_PRINTOUT and exe.getRefModuleApid() == (uint8_t) supv::Apid::HK and
exe.getRefServiceId() == (uint8_t) supv::tc::HkId::GET_REPORT) {
if (REDUCE_NORMAL_MODE_PRINTOUT and exe.getRefModuleApid() == (uint8_t)supv::Apid::HK and
exe.getRefServiceId() == (uint8_t)supv::tc::HkId::GET_REPORT) {
return;
}
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK)) {
@ -916,6 +922,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
} else if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_NAK)) {
handleExecutionFailureReport(report);
}
commandIsPending = false;
nextReplyId = supv::NONE;
return result;
}
@ -1898,7 +1905,11 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionReport& report) {
DeviceCommandId_t commandId = getPendingCommand();
ReturnValue_t result = OK;
DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId);
if (iter->second.sendReplyTo != NO_COMMANDER) {
actionHelper.finish(true, iter->second.sendReplyTo, iter->first, returnvalue::OK);
}
iter->second.isExecuting = false;
commandIsPending = false;
switch (commandId) {
case supv::READ_GPIO: {
@ -1907,14 +1918,13 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionRepor
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
DeviceCommandMap::iterator iter = deviceCommandMap.find(commandId);
if (iter->second.sendReplyTo == NO_COMMAND_ID) {
return returnvalue::OK;
}
uint8_t data[sizeof(gpioState)];
size_t size = 0;
result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState),
SerializeIF::Endianness::BIG);
ReturnValue_t result = SerializeAdapter::serialize(&gpioState, data, &size, sizeof(gpioState),
SerializeIF::Endianness::BIG);
if (result != returnvalue::OK) {
sif::debug << "PlocSupervisorHandler: Failed to deserialize GPIO state" << std::endl;
}
@ -1991,8 +2001,8 @@ uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t mod
}
void PlocSupervisorHandler::disableCommand(DeviceCommandId_t cmd) {
auto commandIter = deviceCommandMap.find(GET_HK_REPORT);
commandIter->second.isExecuting = false;
auto commandIter = deviceCommandMap.find(GET_HK_REPORT);
commandIter->second.isExecuting = false;
}
ReturnValue_t PlocSupervisorHandler::checkModeCommand(Mode_t commandedMode,