From 3d39ddf85c2c005fd9c15dcea8641a9932016845 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Wed, 28 Jul 2021 11:08:40 +0200 Subject: [PATCH] copy adc data to mram command --- mission/devices/PlocSupervisorHandler.cpp | 16 +++++++++++++++- .../PlocSupervisorDefinitions.h | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mission/devices/PlocSupervisorHandler.cpp b/mission/devices/PlocSupervisorHandler.cpp index 367cc642..6ba7f6ad 100644 --- a/mission/devices/PlocSupervisorHandler.cpp +++ b/mission/devices/PlocSupervisorHandler.cpp @@ -170,6 +170,11 @@ ReturnValue_t PlocSupervisorHandler::buildCommandFromCommand( prepareEmptyCmd(PLOC_SPV::APID_GET_LATCHUP_STATUS_REPORT); result = RETURN_OK; break; + } + case(PLOC_SPV::COPY_ADC_DATA_TO_MRAM): { + prepareEmptyCmd(PLOC_SPV::APID_COPY_ADC_DATA_TO_MRAM); + result = RETURN_OK; + break; } default: sif::debug << "PlocSupervisorHandler::buildCommandFromCommand: Command not implemented" @@ -213,6 +218,7 @@ void PlocSupervisorHandler::fillCommandAndReplyMap() { this->insertInCommandMap(PLOC_SPV::SET_ADC_WINDOW_AND_STRIDE); this->insertInCommandMap(PLOC_SPV::SET_ADC_THRESHOLD); this->insertInCommandMap(PLOC_SPV::GET_LATCHUP_STATUS_REPORT); + this->insertInCommandMap(PLOC_SPV::COPY_ADC_DATA_TO_MRAM); this->insertInReplyMap(PLOC_SPV::ACK_REPORT, 3, nullptr, PLOC_SPV::SIZE_ACK_REPORT); this->insertInReplyMap(PLOC_SPV::EXE_REPORT, 3, nullptr, PLOC_SPV::SIZE_EXE_REPORT); this->insertInReplyMap(PLOC_SPV::HK_REPORT, 3, &hkset, PLOC_SPV::SIZE_HK_REPORT); @@ -246,6 +252,10 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t *start, *foundLen = PLOC_SPV::SIZE_BOOT_STATUS_REPORT; *foundId = PLOC_SPV::BOOT_STATUS_REPORT; break; + case(PLOC_SPV::APID_LATCHUP_STATUS_REPORT): + *foundLen = PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT; + *foundId = PLOC_SPV::LATCHUP_REPORT; + break; case(PLOC_SPV::APID_EXE_SUCCESS): *foundLen = PLOC_SPV::SIZE_EXE_REPORT; *foundId = PLOC_SPV::EXE_REPORT; @@ -282,6 +292,10 @@ ReturnValue_t PlocSupervisorHandler::interpretDeviceReply(DeviceCommandId_t id, result = handleBootStatusReport(packet); break; } + case (PLOC_SPV::LATCHUP_REPORT): { + result = handleLatchupStatusReport(packet); + break; + } case (PLOC_SPV::EXE_REPORT): { result = handleExecutionReport(packet); break; @@ -684,7 +698,7 @@ ReturnValue_t PlocSupervisorHandler::handleLatchupStatusReport(const uint8_t* da ReturnValue_t result = RETURN_OK; - result = verifyPacket(data, PLOC_SPV::SIZE_BOOT_STATUS_REPORT); + result = verifyPacket(data, PLOC_SPV::SIZE_LATCHUP_STATUS_REPORT); if(result == CRC_FAILURE) { sif::error << "PlocSupervisorHandler::handleLatchupStatusReport: Latchup status report has " diff --git a/mission/devices/devicedefinitions/PlocSupervisorDefinitions.h b/mission/devices/devicedefinitions/PlocSupervisorDefinitions.h index 7eb7c163..2350a42c 100644 --- a/mission/devices/devicedefinitions/PlocSupervisorDefinitions.h +++ b/mission/devices/devicedefinitions/PlocSupervisorDefinitions.h @@ -49,6 +49,7 @@ static const DeviceCommandId_t READ_GPIO = 35; static const DeviceCommandId_t RESTART_SUPERVISOR = 36; static const DeviceCommandId_t FACTORY_RESET = 37; static const DeviceCommandId_t REQUEST_LOGGING_DATA = 38; +static const DeviceCommandId_t UPDATE_IMAGE_DATA = 39; /** Reply IDs */ static const DeviceCommandId_t ACK_REPORT = 50; @@ -61,7 +62,7 @@ static const uint16_t SIZE_ACK_REPORT = 14; static const uint16_t SIZE_EXE_REPORT = 14; static const uint16_t SIZE_HK_REPORT = 48; static const uint16_t SIZE_BOOT_STATUS_REPORT = 22; -static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 55; +static const uint16_t SIZE_LATCHUP_STATUS_REPORT = 51; /** * SpacePacket apids of telemetry packets