From 0ea993e16b59912b181795f62fc6c40efb95e614 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 19 Aug 2022 15:49:22 +0200 Subject: [PATCH] some bugfixes --- .../devicedefinitions/PlocMPSoCDefinitions.h | 2 +- linux/devices/ploc/PlocMPSoCHandler.cpp | 34 ++++++++++--------- linux/devices/ploc/PlocMPSoCHandler.h | 2 +- mission/controller/AcsController.h | 27 +++++++-------- .../AcsCtrlDefinitions.h | 13 +++---- tmtc | 2 +- 6 files changed, 39 insertions(+), 41 deletions(-) diff --git a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h index a293b1f7..0002695d 100644 --- a/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h +++ b/linux/devices/devicedefinitions/PlocMPSoCDefinitions.h @@ -143,7 +143,7 @@ class TcBase : public ploc::SpTcBase, public MPSoCReturnValuesIF { virtual ~TcBase() = default; // Initial length field of space packet. Will always be updated when packet is created. - static const uint16_t INIT_LENGTH = 1; + static const uint16_t INIT_LENGTH = 2; /** * @brief Constructor diff --git a/linux/devices/ploc/PlocMPSoCHandler.cpp b/linux/devices/ploc/PlocMPSoCHandler.cpp index b3eea536..7bfa09d3 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.cpp +++ b/linux/devices/ploc/PlocMPSoCHandler.cpp @@ -410,7 +410,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemWrite(const uint8_t* commandData, sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcMemWrite.getFullPacketLen()); return RETURN_OK; } @@ -424,7 +424,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcMemRead(const uint8_t* commandData, sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcMemRead.getFullPacketLen()); tmMemReadReport.rememberRequestedSize = tcMemRead.getMemLen() * 4 + TmMemReadReport::FIX_SIZE; return RETURN_OK; } @@ -443,7 +443,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcFlashDelete(const uint8_t* commandData, sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcFlashDelete.getFullPacketLen()); return RETURN_OK; } @@ -457,7 +457,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStart(const uint8_t* commandData, sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcReplayStart.getFullPacketLen()); return RETURN_OK; } @@ -470,7 +470,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayStop() { sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcReplayStop.getFullPacketLen()); return RETURN_OK; } @@ -484,7 +484,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOn(const uint8_t* commandDat sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcDownlinkPwrOn.getFullPacketLen()); return RETURN_OK; } @@ -497,7 +497,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkPwrOff() { sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcDownlinkPwrOff.getFullPacketLen()); return RETURN_OK; } @@ -511,7 +511,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcReplayWriteSequence(const uint8_t* comm sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcReplayWriteSeq.getFullPacketLen()); return RETURN_OK; } @@ -524,7 +524,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeReplay() { sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcModeReplay.getFullPacketLen()); return RETURN_OK; } @@ -537,7 +537,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcModeIdle() { sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcModeIdle.getFullPacketLen()); return RETURN_OK; } @@ -551,17 +551,19 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData, sequenceCount--; return result; } - finishTcPrep(); + finishTcPrep(tcCamCmdSend.getFullPacketLen()); nextReplyId = mpsoc::TM_CAM_CMD_RPT; return RETURN_OK; } -void PlocMPSoCHandler::finishTcPrep() { nextReplyId = mpsoc::ACK_REPORT; } +void PlocMPSoCHandler::finishTcPrep(size_t packetLen) { + nextReplyId = mpsoc::ACK_REPORT; + rawPacket = commandBuffer; + rawPacketLen = packetLen; +} ReturnValue_t PlocMPSoCHandler::verifyPacket(const uint8_t* start, size_t foundLen) { - uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1); - uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2); - if (receivedCrc != recalculatedCrc) { + if (CRC::crc16ccitt(start, foundLen) != 0) { return MPSoCReturnValuesIF::CRC_FAILURE; } return RETURN_OK; @@ -683,7 +685,7 @@ ReturnValue_t PlocMPSoCHandler::handleCamCmdRpt(const uint8_t* data) { reinterpret_cast(dataFieldPtr), tmCamCmdRpt.rememberSpacePacketSize - mpsoc::SPACE_PACKET_HEADER_SIZE - sizeof(uint16_t) - 3); #if OBSW_DEBUG_PLOC_MPSOC == 1 - uint8_t ackValue = *(packet.getPacketData() + packet.getPacketDataLength() - 2); + uint8_t ackValue = *(packetReader.getPacketData() + packetReader.getPacketDataLen() - 2); sif::info << "PlocMPSoCHandler: CamCmdRpt message: " << camCmdRptMsg << std::endl; sif::info << "PlocMPSoCHandler: CamCmdRpt Ack value: 0x" << std::hex << static_cast(ackValue) << std::endl; diff --git a/linux/devices/ploc/PlocMPSoCHandler.h b/linux/devices/ploc/PlocMPSoCHandler.h index 4325f8ee..05c2e902 100644 --- a/linux/devices/ploc/PlocMPSoCHandler.h +++ b/linux/devices/ploc/PlocMPSoCHandler.h @@ -172,7 +172,7 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF { ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen); ReturnValue_t prepareTcModeIdle(); - void finishTcPrep(); + void finishTcPrep(size_t packetLen); /** * @brief This function checks the crc of the received PLOC reply. diff --git a/mission/controller/AcsController.h b/mission/controller/AcsController.h index 4fa00283..358b1871 100644 --- a/mission/controller/AcsController.h +++ b/mission/controller/AcsController.h @@ -55,21 +55,20 @@ class AcsController : public ExtendedControllerBase { void copyMgmData(); - // Sun Sensors - std::array susSets { - SUS::SusDataset(objects::SUS_0_N_LOC_XFYFZM_PT_XF), - SUS::SusDataset(objects::SUS_1_N_LOC_XBYFZM_PT_XB), - SUS::SusDataset(objects::SUS_2_N_LOC_XFYBZB_PT_YB), - SUS::SusDataset(objects::SUS_3_N_LOC_XFYBZF_PT_YF), - SUS::SusDataset(objects::SUS_4_N_LOC_XMYFZF_PT_ZF), - SUS::SusDataset(objects::SUS_5_N_LOC_XFYMZB_PT_ZB), - SUS::SusDataset(objects::SUS_6_R_LOC_XFYBZM_PT_XF), - SUS::SusDataset(objects::SUS_7_R_LOC_XBYBZM_PT_XB), - SUS::SusDataset(objects::SUS_8_R_LOC_XBYBZB_PT_YB), - SUS::SusDataset(objects::SUS_9_R_LOC_XBYBZB_PT_YF), - SUS::SusDataset(objects::SUS_10_N_LOC_XMYBZF_PT_ZF), - SUS::SusDataset(objects::SUS_11_R_LOC_XBYMZB_PT_ZB), + std::array susSets{ + SUS::SusDataset(objects::SUS_0_N_LOC_XFYFZM_PT_XF), + SUS::SusDataset(objects::SUS_1_N_LOC_XBYFZM_PT_XB), + SUS::SusDataset(objects::SUS_2_N_LOC_XFYBZB_PT_YB), + SUS::SusDataset(objects::SUS_3_N_LOC_XFYBZF_PT_YF), + SUS::SusDataset(objects::SUS_4_N_LOC_XMYFZF_PT_ZF), + SUS::SusDataset(objects::SUS_5_N_LOC_XFYMZB_PT_ZB), + SUS::SusDataset(objects::SUS_6_R_LOC_XFYBZM_PT_XF), + SUS::SusDataset(objects::SUS_7_R_LOC_XBYBZM_PT_XB), + SUS::SusDataset(objects::SUS_8_R_LOC_XBYBZB_PT_YB), + SUS::SusDataset(objects::SUS_9_R_LOC_XBYBZB_PT_YF), + SUS::SusDataset(objects::SUS_10_N_LOC_XMYBZF_PT_ZF), + SUS::SusDataset(objects::SUS_11_R_LOC_XBYMZB_PT_ZB), }; // Initial delay to make sure all pool variables have been initialized their owners diff --git a/mission/controller/controllerdefinitions/AcsCtrlDefinitions.h b/mission/controller/controllerdefinitions/AcsCtrlDefinitions.h index c3a97f0d..bafe778f 100644 --- a/mission/controller/controllerdefinitions/AcsCtrlDefinitions.h +++ b/mission/controller/controllerdefinitions/AcsCtrlDefinitions.h @@ -8,10 +8,7 @@ namespace acsctrl { -enum SetIds : uint32_t { - MGM_SENSOR_DATA, - SUS_SENSOR_DATA -}; +enum SetIds : uint32_t { MGM_SENSOR_DATA, SUS_SENSOR_DATA }; enum PoolIds : lp_id_t { MGM_0_LIS3_UT, @@ -63,11 +60,11 @@ class MgmData : public StaticLocalDataSet { private: }; - -class SusData: public StaticLocalDataSet { -public: +class SusData : public StaticLocalDataSet { + public: SusData(HasLocalDataPoolIF* hkOwner) : StaticLocalDataSet(hkOwner, SUS_SENSOR_DATA) {} -private: + + private: }; } // namespace acsctrl diff --git a/tmtc b/tmtc index d8b0d81e..00e99292 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d8b0d81ef3165325284956456138b529f6e9fae0 +Subproject commit 00e99292cc158a347f485507537fa5b63262243b