supervisor set time during start up
This commit is contained in:
@ -137,13 +137,37 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId,
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doStartUp() {
|
||||
#ifdef XIPHOS_Q7S
|
||||
switch (startupState) {
|
||||
case StartupState::OFF: {
|
||||
bootTimeout.resetTimer();
|
||||
startupState = StartupState::ON;
|
||||
break;
|
||||
}
|
||||
case StartupState::BOOTING: {
|
||||
if (bootTimeout.hasTimedOut()) {
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
startupState = StartupState::SET_TIME;
|
||||
}
|
||||
}
|
||||
case StartupState::SET_TIME_EXECUTING:
|
||||
break;
|
||||
case StartupState::ON: {
|
||||
setMode(_MODE_TO_ON);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
setMode(_MODE_TO_ON);
|
||||
uartIsolatorSwitch.pullHigh();
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::doShutDown() {
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
uartIsolatorSwitch.pullLow();
|
||||
startupState = StartupState::OFF;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
@ -151,6 +175,11 @@ 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;
|
||||
return RETURN_OK;
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
@ -161,8 +190,6 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
|
||||
ReturnValue_t result = RETURN_FAILED;
|
||||
switch (deviceCommand) {
|
||||
case GET_HK_REPORT: {
|
||||
sif::warning << "PlocSupervisorHandler::buildCommandFromCommand: Housekeeping report is "
|
||||
<< "faulty. Needs to be fixed in vorago software" << std::endl;
|
||||
prepareEmptyCmd(APID_GET_HK_REPORT);
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
@ -676,7 +703,9 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
|
||||
void PlocSupervisorHandler::setNormalDatapoolEntriesInvalid() {}
|
||||
|
||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
|
||||
uint32_t PlocSupervisorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||
return 7000;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupervisorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
@ -897,20 +926,12 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
|
||||
switch (result) {
|
||||
case (RETURN_OK): {
|
||||
handleSpecialExecutionReport(data);
|
||||
handleExecutionSuccessReport(data);
|
||||
break;
|
||||
}
|
||||
case (SupvReturnValuesIF::RECEIVED_EXE_FAILURE): {
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||
} else {
|
||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id"
|
||||
<< std::endl;
|
||||
}
|
||||
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
|
||||
disableExeReportReply();
|
||||
result = IGNORE_REPLY_DATA;
|
||||
handleExecutionFailureReport();
|
||||
result = RETURN_OK;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@ -919,9 +940,7 @@ ReturnValue_t PlocSupervisorHandler::handleExecutionReport(const uint8_t* data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nextReplyId = supv::NONE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1567,6 +1586,7 @@ void PlocSupervisorHandler::disableExeReportReply() {
|
||||
DeviceReplyInfo* info = &(iter->second);
|
||||
info->delayCycles = 0;
|
||||
info->command = deviceCommandMap.end();
|
||||
info->active = false;
|
||||
/* Expected replies is set to one here. The value will set to 0 in replyToReply() */
|
||||
info->command->second.expectedReplies = 1;
|
||||
}
|
||||
@ -1823,7 +1843,7 @@ ReturnValue_t PlocSupervisorHandler::eventSubscription() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
|
||||
void PlocSupervisorHandler::handleExecutionSuccessReport(const uint8_t* data) {
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
switch (commandId) {
|
||||
case supv::READ_GPIO: {
|
||||
@ -1831,12 +1851,30 @@ void PlocSupervisorHandler::handleSpecialExecutionReport(const uint8_t* data) {
|
||||
exe.addWholeData(data, supv::SIZE_EXE_REPORT);
|
||||
uint16_t gpioState = exe.getStatusCode();
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
sif::info << "PlocsupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
||||
sif::info << "PlocSupervisorHandler: Read GPIO TM, State: " << gpioState << std::endl;
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
handleDeviceTM(reinterpret_cast<uint8_t*>(&gpioState), sizeof(gpioState), supv::EXE_REPORT);
|
||||
break;
|
||||
}
|
||||
case supv::SET_TIME_REF: {
|
||||
if (startupState == StartupState::SET_TIME_EXECUTING) {
|
||||
startupState = StartupState::ON;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PlocSupervisorHandler::handleExecutionFailureReport() {
|
||||
using namespace supv;
|
||||
DeviceCommandId_t commandId = getPendingCommand();
|
||||
if (commandId != DeviceHandlerIF::NO_COMMAND_ID) {
|
||||
triggerEvent(SUPV_EXE_FAILURE, commandId);
|
||||
} else {
|
||||
sif::debug << "PlocSupervisorHandler::handleExecutionReport: Unknown command id" << std::endl;
|
||||
}
|
||||
sendFailureReport(EXE_REPORT, SupvReturnValuesIF::RECEIVED_EXE_FAILURE);
|
||||
disableExeReportReply();
|
||||
}
|
||||
|
Reference in New Issue
Block a user