diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b3afe1..bff68d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Fixes +- TC Scheduler Service 11: Add size and CRC check for contained TC. - Only delete health table entry in `HealthHelper` destructor if health table was set. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/710/files @@ -27,6 +28,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Added +- `DleParser` helper class to parse DLE encoded packets from a byte stream. + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/711 - `UioMapper` is able to resolve symlinks now. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/709 - Add new `UnsignedByteField` class diff --git a/src/fsfw/pus/Service11TelecommandScheduling.h b/src/fsfw/pus/Service11TelecommandScheduling.h index aa958193..83b2b4c0 100644 --- a/src/fsfw/pus/Service11TelecommandScheduling.h +++ b/src/fsfw/pus/Service11TelecommandScheduling.h @@ -41,6 +41,8 @@ class Service11TelecommandScheduling final : public PusServiceBase { static constexpr ReturnValue_t INVALID_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 2); static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 3); static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 4); + static constexpr ReturnValue_t CONTAINED_TC_TOO_SMALL = returnvalue::makeCode(CLASS_ID, 5); + static constexpr ReturnValue_t CONTAINED_TC_CRC_MISSMATCH = returnvalue::makeCode(CLASS_ID, 6); static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11; diff --git a/src/fsfw/pus/Service11TelecommandScheduling.tpp b/src/fsfw/pus/Service11TelecommandScheduling.tpp index 47b0e5c8..962d84ac 100644 --- a/src/fsfw/pus/Service11TelecommandScheduling.tpp +++ b/src/fsfw/pus/Service11TelecommandScheduling.tpp @@ -6,6 +6,8 @@ #include "fsfw/serialize/SerializeAdapter.h" #include "fsfw/serviceinterface.h" #include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" +#include "fsfw/tmtcpacket/pus/tc/PusTcIF.h" +#include "fsfw/globalfunctions/CRC.h" static constexpr auto DEF_END = SerializeIF::Endianness::BIG; @@ -171,6 +173,14 @@ inline ReturnValue_t Service11TelecommandScheduling::doInsertActivi return returnvalue::FAILED; } + if (size < PusTcIF::MIN_SIZE) { + return CONTAINED_TC_TOO_SMALL; + } + + if (CRC::crc16ccitt(data, size) != 0) { + return CONTAINED_TC_CRC_MISSMATCH; + } + // store currentPacket and receive the store address store_address_t addr{}; if (tcStore->addData(&addr, data, size) != returnvalue::OK || diff --git a/src/fsfw/subsystem/SubsystemBase.cpp b/src/fsfw/subsystem/SubsystemBase.cpp index d14e3539..7f215f60 100644 --- a/src/fsfw/subsystem/SubsystemBase.cpp +++ b/src/fsfw/subsystem/SubsystemBase.cpp @@ -195,7 +195,7 @@ ReturnValue_t SubsystemBase::checkTable(HybridIterator tableIter) if (childrenMap.find(tableIter.value->getObject()) == childrenMap.end()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 using namespace std; - sif::warning << "SubsystemBase::checkTable: Could not find Object " << setfill('0') << hex + sif::warning << "SubsystemBase::checkTable: Could not find object " << setfill('0') << hex << "0x" << setw(8) << tableIter.value->getObject() << " in object " << setw(8) << setw(0) << "0x" << setw(8) << SystemObject::getObjectId() << dec << std::endl; #endif diff --git a/src/fsfw/tmtcservices/SourceSequenceCounter.h b/src/fsfw/tmtcservices/SourceSequenceCounter.h index 43b6945c..f530b444 100644 --- a/src/fsfw/tmtcservices/SourceSequenceCounter.h +++ b/src/fsfw/tmtcservices/SourceSequenceCounter.h @@ -11,7 +11,7 @@ class SourceSequenceCounter { SourceSequenceCounter(uint16_t initialSequenceCount = 0) : sequenceCount(initialSequenceCount) {} void increment() { sequenceCount = (sequenceCount + 1) % (ccsds::LIMIT_SEQUENCE_COUNT); } void decrement() { sequenceCount = (sequenceCount - 1) % (ccsds::LIMIT_SEQUENCE_COUNT); } - uint16_t get() { return this->sequenceCount; } + uint16_t get() const { return this->sequenceCount; } void reset(uint16_t toValue = 0) { sequenceCount = toValue % (ccsds::LIMIT_SEQUENCE_COUNT); } SourceSequenceCounter& operator++(int) { this->increment(); diff --git a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp index 707ca338..aa7c22d4 100644 --- a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp +++ b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp @@ -329,8 +329,8 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) { // Now scale to physical value in microtesla float fieldStrengthX = fieldStrengthRawX * scaleFactorX; - float fieldStrengthY = fieldStrengthRawY * scaleFactorX; - float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX; + float fieldStrengthY = fieldStrengthRawY * scaleFactorY; + float fieldStrengthZ = fieldStrengthRawZ * scaleFactorZ; if (periodicPrintout) { if (debugDivider.checkAndIncrement()) {