Merge pull request 'Bugfix for Packet ID getters' (#524) from eive/fsfw:mueller/bugfix-improvements-packet-id-functions into development
All checks were successful
fsfw/fsfw/pipeline/head This commit looks good
All checks were successful
fsfw/fsfw/pipeline/head This commit looks good
Reviewed-on: #524
This commit is contained in:
commit
ab7117d81e
@ -73,7 +73,7 @@ namespace spacepacket {
|
||||
|
||||
constexpr uint16_t getSpacePacketIdFromApid(bool isTc, uint16_t apid,
|
||||
bool secondaryHeaderFlag = true) {
|
||||
return (((isTc << 5) & 0x10) | ((secondaryHeaderFlag << 4) & 0x08) |
|
||||
return ((isTc << 4) | (secondaryHeaderFlag << 3) |
|
||||
((apid >> 8) & 0x07)) << 8 | (apid & 0x00ff);
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
PusTmTest.cpp
|
||||
testCcsds.cpp
|
||||
)
|
||||
|
11
tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp
Normal file
11
tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "fsfw/tmtcpacket/SpacePacket.h"
|
||||
|
||||
TEST_CASE( "CCSDS Test" , "[ccsds]") {
|
||||
REQUIRE(spacepacket::getTcSpacePacketIdFromApid(0x22) == 0x1822);
|
||||
REQUIRE(spacepacket::getTmSpacePacketIdFromApid(0x22) == 0x0822);
|
||||
|
||||
REQUIRE(spacepacket::getTcSpacePacketIdFromApid(0x7ff) == 0x1fff);
|
||||
REQUIRE(spacepacket::getTmSpacePacketIdFromApid(0x7ff) == 0xfff);
|
||||
}
|
Loading…
Reference in New Issue
Block a user