From 9fafccd6f1920bcf6e307615a7f2acb2cf7baf1e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 9 Oct 2024 10:37:52 +0200 Subject: [PATCH] more robust sp creator len setter --- src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.cpp b/src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.cpp index 745d5834..550f0e1a 100644 --- a/src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.cpp +++ b/src/fsfw/tmtcpacket/ccsds/SpacePacketCreator.cpp @@ -43,9 +43,10 @@ ReturnValue_t SpacePacketCreator::serialize(uint8_t **buffer, size_t *size, size void SpacePacketCreator::setCcsdsLenFromTotalDataFieldLen(size_t actualLength) { if (actualLength == 0) { - return; + setDataLenField(actualLength); + } else { + setDataLenField(actualLength - 1); } - setDataLenField(actualLength - 1); } size_t SpacePacketCreator::getSerializedSize() const { return ccsds::HEADER_LEN; }