diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 12e9177f..8fcace4e 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -644,6 +644,7 @@ void ObjectFactory::createPayloadComponents(LinuxLibgpioIF* gpioComIF, PowerSwit auto* supvHandler = new PlocSupervisorHandler(objects::PLOC_SUPERVISOR_HANDLER, supervisorCookie, Gpio(gpioIds::ENABLE_SUPV_UART, gpioComIF), power::PDU1_CH6_PLOC_12V, *supvHelper); + supvHandler->setPowerSwitcher(&pwrSwitch); supvHandler->connectModeTreeParent(satsystem::payload::SUBSYSTEM); #endif /* OBSW_ADD_PLOC_SUPERVISOR == 1 */ static_cast(consumer); diff --git a/linux/payload/PlocSupervisorHandler.cpp b/linux/payload/PlocSupervisorHandler.cpp index 06a4cf07..682b8020 100644 --- a/linux/payload/PlocSupervisorHandler.cpp +++ b/linux/payload/PlocSupervisorHandler.cpp @@ -151,7 +151,7 @@ void PlocSupervisorHandler::doStartUp() { } } } - if (startupState == StartupState::SET_TIME_EXECUTING) { + if (startupState == StartupState::TIME_WAS_SET) { startupState = StartupState::ON; } if (startupState == StartupState::ON) { @@ -176,7 +176,7 @@ ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* ReturnValue_t PlocSupervisorHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) { if (startupState == StartupState::SET_TIME) { *id = supv::SET_TIME_REF; - startupState = StartupState::SET_TIME_EXECUTING; + startupState = StartupState::WAIT_FOR_TIME_REPLY; return buildCommandFromCommand(*id, nullptr, 0); } return NOTHING_TO_SEND; @@ -1909,6 +1909,10 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionSuccessReport(ExecutionRepor case supv::SET_TIME_REF: { // We could only allow proper bootup when the time was set successfully, but // this makes debugging difficult. + + if (startupState == StartupState::WAIT_FOR_TIME_REPLY) { + startupState = StartupState::TIME_WAS_SET; + } break; } default: diff --git a/linux/payload/PlocSupervisorHandler.h b/linux/payload/PlocSupervisorHandler.h index 78c20205..3e5ac2a0 100644 --- a/linux/payload/PlocSupervisorHandler.h +++ b/linux/payload/PlocSupervisorHandler.h @@ -99,7 +99,14 @@ class PlocSupervisorHandler : public DeviceHandlerBase { static const uint32_t MRAM_DUMP_TIMEOUT = 60000; // 4 s static const uint32_t BOOT_TIMEOUT = 4000; - enum class StartupState : uint8_t { OFF, BOOTING, SET_TIME, SET_TIME_EXECUTING, ON }; + enum class StartupState : uint8_t { + OFF, + BOOTING, + SET_TIME, + WAIT_FOR_TIME_REPLY, + TIME_WAS_SET, + ON + }; static constexpr bool SET_TIME_DURING_BOOT = true; diff --git a/tmtc b/tmtc index 5fbd19bb..f090c3af 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 5fbd19bb6cca0790373a809d78f2307adca9d0c8 +Subproject commit f090c3af66d1a0b760344e80053d6e83895e661a