add factory reset cmd
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2022-11-08 20:37:57 +01:00
parent 52f15906d8
commit d3da5bd2d8
3 changed files with 73 additions and 36 deletions

View File

@ -310,6 +310,10 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand(DeviceCommandId_t d
result = returnvalue::OK;
break;
}
case FACTORY_RESET: {
result = prepareFactoryResetCmd(commandData, commandDataLen);
break;
}
case READ_GPIO: {
prepareReadGpioCmd(commandData);
result = returnvalue::OK;
@ -449,13 +453,13 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() {
insertInCommandMap(RUN_AUTO_EM_TESTS);
insertInCommandMap(SET_GPIO);
insertInCommandMap(READ_GPIO);
insertInCommandMap(FACTORY_RESET);
insertInCommandMap(SET_SHUTDOWN_TIMEOUT);
insertInCommandMap(FACTORY_FLASH);
insertInCommandMap(RESET_PL);
// ACK replies, use countdown for them
insertInReplyMap(ACK_REPORT, 0, nullptr, SIZE_ACK_REPORT, false,
&acknowledgementReportTimeout);
insertInReplyMap(ACK_REPORT, 0, nullptr, SIZE_ACK_REPORT, false, &acknowledgementReportTimeout);
insertInReplyMap(EXE_REPORT, 0, nullptr, SIZE_EXE_REPORT, false, &executionReportTimeout);
// TM replies
@ -556,25 +560,26 @@ ReturnValue_t PlocSupervisorHandler::enableReplyInReplyMap(DeviceCommandMap::ite
case SET_ADC_ENABLED_CHANNELS:
case SET_ADC_WINDOW_AND_STRIDE:
case SET_ADC_THRESHOLD:
//case COPY_ADC_DATA_TO_MRAM:
// case COPY_ADC_DATA_TO_MRAM:
case RUN_AUTO_EM_TESTS:
//case WIPE_MRAM:
// case WIPE_MRAM:
case SET_GPIO:
case FACTORY_RESET:
case READ_GPIO:
//case RESTART_SUPERVISOR:
//case FACTORY_RESET_CLEAR_ALL:
//case FACTORY_RESET_CLEAR_MIRROR:
//case FACTORY_RESET_CLEAR_CIRCULAR:
// case RESTART_SUPERVISOR:
// case FACTORY_RESET_CLEAR_ALL:
// case FACTORY_RESET_CLEAR_MIRROR:
// case FACTORY_RESET_CLEAR_CIRCULAR:
case DISABLE_PERIOIC_HK_TRANSMISSION:
//case START_MPSOC_QUIET:
// case START_MPSOC_QUIET:
case SET_SHUTDOWN_TIMEOUT:
case FACTORY_FLASH:
case ENABLE_AUTO_TM:
case DISABLE_AUTO_TM:
//case LOGGING_CLEAR_COUNTERS:
//case LOGGING_SET_TOPIC:
// case LOGGING_CLEAR_COUNTERS:
// case LOGGING_SET_TOPIC:
case RESET_PL:
//case ENABLE_NVMS:
// case ENABLE_NVMS:
enabledReplies = 2;
break;
default:
@ -1565,6 +1570,21 @@ ReturnValue_t PlocSupervisorHandler::prepareReadGpioCmd(const uint8_t* commandDa
return returnvalue::OK;
}
ReturnValue_t PlocSupervisorHandler::prepareFactoryResetCmd(const uint8_t* commandData,
size_t len) {
FactoryReset resetCmd(spParams);
std::optional<uint8_t> op;
if (len > 0) {
op = commandData[0];
}
ReturnValue_t result = resetCmd.buildPacket(op);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(resetCmd.getFullPacketLen());
return returnvalue::OK;
}
void PlocSupervisorHandler::finishTcPrep(size_t packetLen) {
nextReplyId = supv::ACK_REPORT;
rawPacket = commandBuffer;