almost there.. I think
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit
This commit is contained in:
@ -10,6 +10,7 @@
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "fsfw/returnvalues/returnvalue.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
#include "linux/payload/plocSupvDefs.h"
|
||||
|
||||
using namespace supv;
|
||||
@ -33,7 +34,7 @@ FreshSupvHandler::FreshSupvHandler(DhbConfig cfg, CookieIF* comCookie, Gpio uart
|
||||
adcReport(this) {
|
||||
spParams.buf = commandBuffer.data();
|
||||
spParams.maxSize = commandBuffer.size();
|
||||
eventQueue = QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||
eventQueue = QueueFactory::instance()->createMessageQueue(10);
|
||||
}
|
||||
|
||||
void FreshSupvHandler::performDeviceOperation(uint8_t opCode) {
|
||||
@ -70,16 +71,9 @@ void FreshSupvHandler::performDeviceOperation(uint8_t opCode) {
|
||||
}
|
||||
} else {
|
||||
if (mode == MODE_NORMAL) {
|
||||
if (hkRequestCmdInfo.isPending and hkRequestCmdInfo.cmdCountdown.hasTimedOut()) {
|
||||
// trigger event? might lead to spam...
|
||||
sif::warning << "FreshSupvHandler: No reply received for HK set request" << std::endl;
|
||||
hkRequestCmdInfo.isPending = false;
|
||||
}
|
||||
// Normal mode handling. Request normal data sets and add them to command map.
|
||||
if (not hkRequestCmdInfo.isPending) {
|
||||
hkRequestCmdInfo.cmdCountdown.resetTimer();
|
||||
hkRequestCmdInfo.ackExeRecv = false;
|
||||
hkRequestCmdInfo.ackRecv = false;
|
||||
auto cmdIter = activeActionCmds.find(
|
||||
buildActiveCmdKey(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT)));
|
||||
if (cmdIter == activeActionCmds.end() or not cmdIter->second.isPending) {
|
||||
sendEmptyCmd(Apid::HK, static_cast<uint8_t>(tc::HkId::GET_REPORT), true);
|
||||
}
|
||||
}
|
||||
@ -436,7 +430,7 @@ ReturnValue_t FreshSupvHandler::prepareSelBootImageCmd(const uint8_t* commandDat
|
||||
}
|
||||
|
||||
void FreshSupvHandler::startTransition(Mode_t newMode, Submode_t newSubmode) {
|
||||
if (newMode == mode) {
|
||||
if (newMode == mode or (mode == MODE_ON and newMode == MODE_NORMAL)) {
|
||||
// Can finish immediately.
|
||||
setMode(newMode, newSubmode);
|
||||
return;
|
||||
@ -453,9 +447,7 @@ void FreshSupvHandler::startTransition(Mode_t newMode, Submode_t newSubmode) {
|
||||
}
|
||||
|
||||
void FreshSupvHandler::handleTransitionToOn() {
|
||||
sif::debug << "psupv: trans to on" << std::endl;
|
||||
if (startupState == StartupState::IDLE) {
|
||||
bootTimeout.resetTimer();
|
||||
startupState = StartupState::POWER_SWITCHING;
|
||||
switchIF.sendSwitchCommand(switchId, PowerSwitchIF::SWITCH_ON);
|
||||
switchTimeout.resetTimer();
|
||||
@ -468,6 +460,7 @@ void FreshSupvHandler::handleTransitionToOn() {
|
||||
if (startupState == StartupState::POWER_SWITCHING) {
|
||||
if (switchIF.getSwitchState(switchId) == PowerSwitchIF::SWITCH_ON) {
|
||||
startupState = StartupState::BOOTING;
|
||||
bootTimeout.resetTimer();
|
||||
} else if (switchTimeout.hasTimedOut()) {
|
||||
targetMode = MODE_OFF;
|
||||
shutdownState = ShutdownState::IDLE;
|
||||
@ -489,8 +482,9 @@ void FreshSupvHandler::handleTransitionToOn() {
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "FreshSupvHandler: Setting time command prepration failed" << std::endl;
|
||||
startupState = StartupState::ON;
|
||||
} else {
|
||||
startupState = StartupState::WAIT_FOR_TIME_REPLY;
|
||||
}
|
||||
startupState = StartupState::WAIT_FOR_TIME_REPLY;
|
||||
}
|
||||
if (startupState == StartupState::TIME_WAS_SET) {
|
||||
startupState = StartupState::ON;
|
||||
@ -498,7 +492,6 @@ void FreshSupvHandler::handleTransitionToOn() {
|
||||
if (startupState == StartupState::ON) {
|
||||
hkSet.setReportingEnabled(true);
|
||||
supv::SUPV_ON = true;
|
||||
sif::debug << "psupv: going on" << std::endl;
|
||||
transitionActive = false;
|
||||
setMode(targetMode);
|
||||
}
|
||||
@ -515,7 +508,6 @@ void FreshSupvHandler::handleTransitionToOff() {
|
||||
}
|
||||
if (shutdownState == ShutdownState::POWER_SWITCHING) {
|
||||
if (switchIF.getSwitchState(switchId) == PowerSwitchIF::SWITCH_OFF or modeHelper.isTimedOut()) {
|
||||
sif::debug << "psupv: going off" << std::endl;
|
||||
supv::SUPV_ON = false;
|
||||
transitionActive = false;
|
||||
setMode(MODE_OFF);
|
||||
@ -525,7 +517,7 @@ void FreshSupvHandler::handleTransitionToOff() {
|
||||
|
||||
ReturnValue_t FreshSupvHandler::sendCommand(TcBase& tc, bool replyExpected,
|
||||
uint32_t cmdCountdownMs) {
|
||||
if (DEBUG_PLOC_SUPV) {
|
||||
if (supv::DEBUG_PLOC_SUPV) {
|
||||
sif::debug << "PLOC SUPV: SEND PACKET Size " << tc.getFullPacketLen() << " Module APID "
|
||||
<< (int)tc.getModuleApid() << " Service ID " << (int)tc.getServiceId() << std::endl;
|
||||
}
|
||||
@ -557,7 +549,9 @@ ReturnValue_t FreshSupvHandler::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return FreshDeviceHandlerBase::initialize();
|
||||
result = FreshDeviceHandlerBase::initialize();
|
||||
sif::debug << "serial port: " << uartManager.serialPort << std::endl;
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t FreshSupvHandler::sendEmptyCmd(uint16_t apid, uint8_t serviceId, bool replyExpected) {
|
||||
@ -812,7 +806,7 @@ ReturnValue_t FreshSupvHandler::parseTmPackets() {
|
||||
}
|
||||
tmReader.setData(receivedData, receivedSize);
|
||||
uint16_t apid = tmReader.getModuleApid();
|
||||
if (DEBUG_PLOC_SUPV) {
|
||||
if (supv::DEBUG_PLOC_SUPV) {
|
||||
handlePacketPrint();
|
||||
}
|
||||
switch (apid) {
|
||||
@ -904,7 +898,8 @@ void FreshSupvHandler::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
|
||||
if (supv::REDUCE_NORMAL_MODE_PRINTOUT and
|
||||
ack.getRefModuleApid() == (uint8_t)supv::Apid::HK and
|
||||
ack.getRefServiceId() == (uint8_t)supv::tc::HkId::GET_REPORT) {
|
||||
return;
|
||||
}
|
||||
@ -927,7 +922,8 @@ void FreshSupvHandler::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
|
||||
if (supv::REDUCE_NORMAL_MODE_PRINTOUT and
|
||||
exe.getRefModuleApid() == (uint8_t)supv::Apid::HK and
|
||||
exe.getRefServiceId() == (uint8_t)supv::tc::HkId::GET_REPORT) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user