v1.17.0 #327

Merged
muellerr merged 131 commits from develop into main 2022-11-28 18:29:31 +01:00
3 changed files with 17 additions and 9 deletions
Showing only changes of commit 72f8e359bb - Show all commits

View File

@ -310,7 +310,9 @@ enum class TmtcManStatusCode : uint32_t {
BAD_SP_HEADER = 0x608
};
static const uint16_t APID_MASK = 0x3FF;
static constexpr uint16_t APID_MASK_TC = 0x200;
static constexpr uint16_t APID_MASK_TM = 0x400;
static constexpr uint16_t APID_MODULE_MASK = 0x7F;
static const uint16_t SEQUENCE_COUNT_MASK = 0xFFF;
static const uint8_t HK_SET_ENTRIES = 13;
@ -485,7 +487,8 @@ class TcBase : public ploc::SpTcBase {
: TcBase(params, apid, service, payloadLen, DEFAULT_SEQ_COUNT) {}
TcBase(TcParams params, uint16_t apid, uint8_t serviceId, size_t payloadLen, uint16_t seqCount)
: ploc::SpTcBase(params, apid, fullSpDataLenFromPayloadLen(payloadLen), seqCount) {
: ploc::SpTcBase(params, apid | APID_MASK_TC, fullSpDataLenFromPayloadLen(payloadLen),
seqCount) {
setup(serviceId);
}
@ -496,6 +499,8 @@ class TcBase : public ploc::SpTcBase {
payloadStart[supv::PAYLOAD_OFFSET] = id;
}
uint16_t getModuleApid() const { return getApid() & APID_MODULE_MASK; }
uint8_t getServiceId() const { return payloadStart[supv::PAYLOAD_OFFSET]; }
static size_t fullSpDataLenFromPayloadLen(size_t payloadLen) {
@ -541,6 +546,8 @@ class TmBase : public ploc::SpTmReader {
uint8_t getServiceId() const { return getPacketData()[TIMESTAMP_LEN]; }
uint16_t getModuleApid() const { return getApid() & APID_MODULE_MASK; }
const uint8_t* getPayloadStart() const { return getPacketData() + SECONDARY_HEADER_LEN; }
size_t getPayloadLen() const {
if (getFullPacketLen() > SECONDARY_HEADER_LEN + ccsds::HEADER_LEN) {
@ -1430,7 +1437,7 @@ class VerificationReport {
break;
}
}
} else if (statusCode < 0x200 and statusCode > 0x100) {
} else if (statusCode < 0x200 and statusCode >= 0x100) {
BootManStatusCode code = static_cast<BootManStatusCode>(statusCode);
switch (code) {
case BootManStatusCode::NOTHING_TODO: {
@ -1474,7 +1481,7 @@ class VerificationReport {
break;
}
}
} else if (statusCode < 0x300 and statusCode > 0x200) {
} else if (statusCode < 0x300 and statusCode >= 0x200) {
MemManStatusCode code = static_cast<MemManStatusCode>(statusCode);
switch (code) {
case MemManStatusCode::SP_NOT_AVAILABLE: {
@ -1522,7 +1529,7 @@ class VerificationReport {
break;
}
}
} else if (statusCode < 0x400 and statusCode > 0x300) {
} else if (statusCode < 0x400 and statusCode >= 0x300) {
PowerManStatusCode code = static_cast<PowerManStatusCode>(statusCode);
switch (code) {
case PowerManStatusCode::PG_LOW: {

View File

@ -588,7 +588,7 @@ ReturnValue_t PlocSupervisorHandler::scanForReply(const uint8_t* start, size_t r
tmReader.setData(start, remainingSize);
sif::debug << "PlocSupervisorHandler::scanForReply: Received Packet" << std::endl;
arrayprinter::print(start, remainingSize);
uint16_t apid = tmReader.getApid(); //(*(start) << 8 | *(start + 1)) & APID_MASK;
uint16_t apid = tmReader.getModuleApid();
switch (apid) {
case (Apid::TMTC_MAN): {

View File

@ -583,7 +583,7 @@ ReturnValue_t PlocSupvUartManager::handlePacketTransmissionNoReply(
if (result != returnvalue::OK) {
continue;
}
if (tmReader.getApid() == Apid::TMTC_MAN) {
if (tmReader.getModuleApid() == Apid::TMTC_MAN) {
uint8_t serviceId = tmReader.getServiceId();
int retval = 0;
if (not ackReceived) {
@ -769,7 +769,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand() {
continue;
}
packetWasHandled = false;
if (tmReader.getApid() == Apid::TMTC_MAN) {
if (tmReader.getModuleApid() == Apid::TMTC_MAN) {
uint8_t serviceId = tmReader.getServiceId();
int retval = 0;
if (not ackReceived) {
@ -790,7 +790,7 @@ ReturnValue_t PlocSupvUartManager::handleCheckMemoryCommand() {
return returnvalue::FAILED;
}
}
} else if (tmReader.getApid() == Apid::MEM_MAN) {
} else if (tmReader.getModuleApid() == Apid::MEM_MAN) {
if (ackReceived) {
supv::UpdateStatusReport report(tmReader);
result = report.parse();
@ -1149,6 +1149,7 @@ int PlocSupvUartManager::removeHdlcFramingWithCrcCheck(const uint8_t* src, size_
if (calcCrc != crc) {
return 1;
}
// This does not work because the CRC is little endian
// if(calc_crc16_buff_reflected(dst, tlen) != 0) {
// return 1;
// }