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

View File

@ -97,11 +97,11 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
static const uint32_t COPY_ADC_TO_MRAM_TIMEOUT = 70000;
// 60 s
static const uint32_t MRAM_DUMP_TIMEOUT = 60000;
// 2 s
static const uint32_t BOOT_TIMEOUT = 2000;
// 5 s
static const uint32_t BOOT_TIMEOUT = 5000;
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;
@ -138,8 +138,6 @@ class PlocSupervisorHandler : public DeviceHandlerBase {
uint32_t receivedMramDumpPackets = 0;
/** Set to true as soon as a complete space packet is present in the spacePacketBuffer */
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 */
uint8_t spacePacketBuffer[supv::MAX_PACKET_SIZE];