This commit is contained in:
parent
b623f01bea
commit
d8e0f9ffce
@ -61,6 +61,15 @@ ReturnValue_t PlocSupervisorHandler::initialize() {
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::performOperationHook() {
|
||||
if(normalCommandIsPending and normalCmdCd.hasTimedOut()) {
|
||||
// Event, FDIR, printout? Leads to spam though and normally should not happen..
|
||||
normalCommandIsPending = false;
|
||||
}
|
||||
if(commandIsPending and cmdCd.hasTimedOut()) {
|
||||
// Event, FDIR, printout? Leads to spam though and normally should not happen..
|
||||
commandIsPending = false;
|
||||
disableAllReplies();
|
||||
}
|
||||
EventMessage event;
|
||||
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
|
||||
result = eventQueue->receiveMessage(&event)) {
|
||||
@ -177,8 +186,10 @@ void PlocSupervisorHandler::doShutDown() {
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
if (not commandIsExecuting(GET_HK_REPORT)) {
|
||||
if (not normalCommandIsPending) {
|
||||
*id = GET_HK_REPORT;
|
||||
normalCommandIsPending = true;
|
||||
normalCmdCd.resetTimer();
|
||||
return buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
@ -336,6 +347,7 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
result = DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
commandIsPending = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -552,6 +564,9 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
|
||||
}
|
||||
case (Apid::HK): {
|
||||
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::HkId::REPORT)) {
|
||||
normalCommandIsPending = false;
|
||||
// Yeah apparently this is needed??
|
||||
disableCommand(GET_HK_REPORT);
|
||||
*foundLen = tmReader.getFullPacketLen();
|
||||
*foundId = ReplyId::HK_REPORT;
|
||||
return OK;
|
||||
@ -606,6 +621,14 @@ void PlocSupervisorHandler::handlePacketPrint() {
|
||||
if ((tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::ACK)) or
|
||||
(tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::NAK))) {
|
||||
AcknowledgmentReport ack(tmReader);
|
||||
ReturnValue_t result = ack.parse();
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
const char* printStr = "???";
|
||||
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::ACK)) {
|
||||
printStr = "ACK";
|
||||
@ -620,7 +643,15 @@ void PlocSupervisorHandler::handlePacketPrint() {
|
||||
} else if ((tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK)) or
|
||||
(tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_NAK))) {
|
||||
ExecutionReport exe(tmReader);
|
||||
ReturnValue_t result = exe.parse();
|
||||
if (result != returnvalue::OK) {
|
||||
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) {
|
||||
return;
|
||||
}
|
||||
if (tmReader.getServiceId() == static_cast<uint8_t>(supv::tm::TmtcId::EXEC_ACK)) {
|
||||
printStr = "ACK EXE";
|
||||
|
||||
@ -1868,6 +1899,7 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
|
||||
ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionReport& report) {
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
ReturnValue_t result = OK;
|
||||
commandIsPending = false;
|
||||
switch (commandId) {
|
||||
case supv::READ_GPIO: {
|
||||
// TODO: Fix
|
||||
@ -1958,6 +1990,11 @@ uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t mod
|
||||
return 7000;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::disableCommand(DeviceCommandId_t cmd) {
|
||||
auto commandIter = deviceCommandMap.find(GET_HK_REPORT);
|
||||
commandIter->second.isExecuting = false;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::checkModeCommand(Mode_t commandedMode,
|
||||
Submode_t commandedSubmode,
|
||||
uint32_t* msToReachTheMode) {
|
||||
|
@ -20,7 +20,8 @@
|
||||
using supv::ExecutionReport;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the supervisor of the PLOC which is programmed by
|
||||
@ -94,7 +95,7 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
// 5 s
|
||||
static const uint32_t EXECUTION_DEFAULT_TIMEOUT = 5000;
|
||||
// 70 S
|
||||
static const uint32_t ACKNOWLEDGE_DEFAULT_TIMEOUT = 70000;
|
||||
static const uint32_t ACKNOWLEDGE_DEFAULT_TIMEOUT = 5000;
|
||||
// 60 s
|
||||
static const uint32_t MRAM_DUMP_EXECUTION_TIMEOUT = 60000;
|
||||
// 70 s
|
||||
@ -131,6 +132,13 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
Gpio uartIsolatorSwitch;
|
||||
bool shutdownCmdSent = false;
|
||||
// Yeah, I am using an extra variable because I once again don't know
|
||||
// what the hell the base class is doing and I don't care anymore.
|
||||
bool normalCommandIsPending = false;
|
||||
// True men implement their reply timeout handling themselves!
|
||||
Countdown normalCmdCd = Countdown(2000);
|
||||
bool commandIsPending = false;
|
||||
Countdown cmdCd = Countdown(2000);
|
||||
|
||||
supv::HkSet hkset;
|
||||
supv::BootStatusReport bootStatusReport;
|
||||
@ -240,6 +248,8 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
|
||||
ReturnValue_t genericHandleTm(const char* contextString, const uint8_t* data,
|
||||
LocalPoolDataSetBase& set);
|
||||
|
||||
void disableCommand(DeviceCommandId_t cmd);
|
||||
|
||||
/**
|
||||
* @brief Depending on the current active command, this function sets the reply id of the
|
||||
* next reply after a successful acknowledgment report has been received. This is
|
||||
|
@ -329,7 +329,7 @@ static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
|
||||
static const uint8_t HK_SET_ENTRIES = 13;
|
||||
static const uint8_t BOOT_REPORT_SET_ENTRIES = 10;
|
||||
static const uint8_t LATCHUP_RPT_SET_ENTRIES = 16;
|
||||
static const uint8_t LOGGING_RPT_SET_ENTRIES = 16;
|
||||
static const uint8_t LOGGING_RPT_SET_ENTRIES = 30;
|
||||
static const uint8_t ADC_RPT_SET_ENTRIES = 32;
|
||||
|
||||
static const uint32_t HK_SET_ID = HK_REPORT;
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 99c6c8bbd0d791d8b17720de481c6142091a54a4
|
||||
Subproject commit c4bd355146a2f5894a93a30f0c7f61aeef43e764
|
Loading…
x
Reference in New Issue
Block a user