improvements for ploc supv SW
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-12-23 11:46:01 +01:00
parent 04b9b03502
commit cfae090de4
2 changed files with 24 additions and 22 deletions

View File

@ -136,29 +136,34 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
} }
void PlocSupervisorHandler::doStartUp() { void PlocSupervisorHandler::doStartUp() {
if (setTimeDuringStartup) { if (startupState == StartupState::OFF) {
if (startupState == StartupState::OFF) { bootTimeout.resetTimer();
bootTimeout.resetTimer(); startupState = StartupState::BOOTING;
startupState = StartupState::BOOTING; }
} if (startupState == StartupState::BOOTING) {
if (startupState == StartupState::BOOTING) { if (bootTimeout.hasTimedOut()) {
if (bootTimeout.hasTimedOut()) { uartIsolatorSwitch.pullHigh();
uartIsolatorSwitch.pullHigh(); uartManager.start();
uartManager.start(); if (SET_TIME_DURING_BOOT) {
startupState = StartupState::SET_TIME; startupState = StartupState::SET_TIME;
} else {
startupState = StartupState::ON;
} }
} }
if (startupState == StartupState::ON) { }
setMode(_MODE_TO_ON); if (startupState == StartupState::SET_TIME_EXECUTING) {
} startupState = StartupState::ON;
} else { }
uartIsolatorSwitch.pullHigh(); if (startupState == StartupState::ON) {
setMode(_MODE_TO_ON); setMode(_MODE_TO_ON);
} }
} }
void PlocSupervisorHandler::doShutDown() { void PlocSupervisorHandler::doShutDown() {
setMode(_MODE_POWER_DOWN); setMode(_MODE_POWER_DOWN);
shutdownCmdSent = false;
packetInBuffer = false;
nextReplyId = supv::NONE;
uartManager.stop(); uartManager.stop();
uartIsolatorSwitch.pullLow(); uartIsolatorSwitch.pullLow();
startupState = StartupState::OFF; startupState = StartupState::OFF;
@ -1896,9 +1901,8 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionRepor
break; break;
} }
case supv::SET_TIME_REF: { case supv::SET_TIME_REF: {
if (startupState == StartupState::SET_TIME_EXECUTING) { // We could only allow proper bootup when the time was set successfully, but
startupState = StartupState::ON; // this makes debugging difficult.
}
break; break;
} }
default: default:

View File

@ -97,11 +97,11 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000; static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000;
// 60 s // 60 s
static const uint32_t MRAM_DUMP_TIMEOUT = 60000; static const uint32_t MRAM_DUMP_TIMEOUT = 60000;
// 2 s // 5 s
static const uint32_t BOOT_TIMEOUT = 2000; static const uint32_t BOOT_TIMEOUT = 5000;
enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON }; enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON };
bool setTimeDuringStartup = true; static constexpr bool SET_TIME_DURING_BOOT = true;
StartupState startupState = StartupState::OFF; StartupState startupState = StartupState::OFF;
@ -138,8 +138,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
uint32_t receivedMramDumpPackets = 0; uint32_t receivedMramDumpPackets = 0;
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */ /** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
bool packetInBuffer = false; bool packetInBuffer = false;
/** Points to the next free position in the space packet buffer */
uint16_t bufferTop = 0;
/** This buffer is used to concatenate space packets received in two different read steps */ /** This buffer is used to concatenate space packets received in two different read steps */
uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE]; uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE];