Skip to content

Commit e920af6

Browse files
committed
fix nmea checksum error in -o 6
1 parent 0e63d7c commit e920af6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Source/Marine/NMEA.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ namespace AIS
9393
if (crc_check)
9494
return;
9595

96-
tag.error = MESSAGE_ERROR_NMEA_CHECKSUM;
96+
aivdm.message_error |= MESSAGE_ERROR_NMEA_CHECKSUM;
9797
}
9898

9999
if (aivdm.count == 1)
100100
{
101+
tag.error = aivdm.message_error;
102+
101103
msg.clear();
102104
msg.Stamp(stamp ? 0 : t);
103105
msg.setOrigin(aivdm.channel, thisstation == -1 ? station : thisstation, own_mmsi);
@@ -151,6 +153,8 @@ namespace AIS
151153
(aivdm.groupId == 0 && it->channel == aivdm.channel && it->talkerID == aivdm.talkerID);
152154
if (match && it->count == aivdm.count && it->ID == aivdm.ID)
153155
{
156+
tag.error |= it->message_error;
157+
154158
addline(*it);
155159
if (!regenerate)
156160
msg.NMEA.push_back(it->sentence);

Source/Marine/NMEA.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace AIS
6060
data.clear();
6161
timestamp = time(nullptr);
6262
groupId = 0;
63+
message_error = 0;
6364
}
6465
char channel;
6566
int count;
@@ -68,6 +69,7 @@ namespace AIS
6869
int checksum;
6970
int fillbits;
7071
int talkerID;
72+
uint32_t message_error;
7173
} aivdm;
7274

7375
std::vector<std::string> parts;

0 commit comments

Comments
 (0)