that was hopefully the last set of fixes
This commit is contained in:
parent
5a15d39a1d
commit
80160e8291
@ -68,18 +68,33 @@ ReturnValue_t PusTmFunnel::handleTmPacket(TmTcMessage &message) {
|
||||
return result;
|
||||
}
|
||||
packet.setSequenceCount(sourceSequenceCount++);
|
||||
// NOTE: This only works because the limit value bit width is below 16 bits!
|
||||
sourceSequenceCount = sourceSequenceCount % ccsds::LIMIT_SEQUENCE_COUNT;
|
||||
uint8_t service = packet.getMessageTypeCounter();
|
||||
|
||||
// Message type counter handling.
|
||||
uint8_t service = packet.getService();
|
||||
bool insertionFailed = false;
|
||||
auto mapIter = msgCounterMap.find(service);
|
||||
if (mapIter == msgCounterMap.end()) {
|
||||
msgCounterMap.emplace(service, 0);
|
||||
auto iterPair = msgCounterMap.emplace(service, 0);
|
||||
if (iterPair.second) {
|
||||
mapIter = iterPair.first;
|
||||
} else {
|
||||
// Should really never never happen but you never know..
|
||||
insertionFailed = true;
|
||||
}
|
||||
}
|
||||
if (not insertionFailed) {
|
||||
packet.setMessageCount(mapIter->second);
|
||||
// Sane overflow handling.
|
||||
if (mapIter->second == std::numeric_limits<uint16_t>::max()) {
|
||||
mapIter->second = 0;
|
||||
} else {
|
||||
mapIter->second++;
|
||||
}
|
||||
packet.setMessageCount(mapIter->second);
|
||||
}
|
||||
|
||||
// Re-calculate CRC after changing the fields. This operation HAS to come last!
|
||||
packet.updateErrorControl();
|
||||
|
||||
// Send to persistent TM store if the packet matches some filter.
|
||||
|
Loading…
Reference in New Issue
Block a user