I’m not hard core enough to try and compile this but i’d thought i’d check my airspy_adsb if it spits out any duplicate messages …
(none as far as i can see)
But i’m curious what you would get, this is some code for decodeModesMessage() in mode_s.c:
static char lastMsg[MODES_LONG_MSG_BYTES];
static int64_t lastTimestampMsg;
if (mm->timestampMsg != MAGIC_MLAT_TIMESTAMP
&& memcmp(lastMsg, msg, MODES_LONG_MSG_BYTES) == 0
&& (imaxabs((int64_t) mm->timestampMsg - lastTimestampMsg) < 10e-6 * 12e6)) {
// discard duplicates with receiver timestamps closer than 10 us (somewhat arbitrary)
// this might not work with Radarcape as the timestamps don't use a 12 MHz timebase (not sure about it)
// Modes.stats_current.messages_rejected_dupe++;
displayModesMessage(mm);
return -2;
}
lastTimestampMsg = mm->timestampMsg;
memcpy(lastMsg, msg, MODES_LONG_MSG_BYTES);
Instead of increasing the stats counter an fprintf should also work provided it’s low frequency enough.
Was just thinking about this with oversampling and stuff … might be interesting to check.
I’ll probably remove that code from my readsb again as in most situations it’s useless overhead
The way the detection is implemented in airspy_adsb, the messages cannot be duplicated even if the pulses splatter over time spans larger than the nominal pulse time. It’s easy to check with the MLAT clock.
It never did, i just added it to readsb out of curiousity.
Also adjusted the code slightly to just display the message, see the previous message.
I figured you’d just make it work (anyhow do another copy paste, it properly ignores MLAT now).
It’s not meant to be there permanently either, just for testing
The zero messages are filtered anyhow in decodeMessage place the code below that filter
Totally forgot that i can just use your decoder without recompiling as i’ve already tried … and also check for dupes in my forthcoming chain (which i don’t change anyhow).
Not seeing any dupes.
Oh … i’m stupid this is probably a bad place to check this to actually see the message content.
displaymodesmessage doesn’t work at that point as the message hasn’t been decoded yet.
You can put it before the return 0 in decodeModesmessages though.
static char lastMsg[MODES_LONG_MSG_BYTES];
static int64_t lastTimestampMsg;
if (mm->source != SOURCE_MLAT
&& memcmp(lastMsg, msg, MODES_LONG_MSG_BYTES) == 0
&& (imaxabs((int64_t) mm->timestampMsg - lastTimestampMsg) < 10e-6 * 12e6)) {
// discard duplicates with receiver timestamps closer than 10 us (somewhat arbitrary)
// this might not work with Radarcape as the timestamps don't use a 12 MHz timebase (not sure about it)
displayModesMessage(mm);
return -2;
}
lastTimestampMsg = mm->timestampMsg;
memcpy(lastMsg, msg, MODES_LONG_MSG_BYTES);
// all done
return 0;
}
Oh and if you want some statistics, just add
Modes.stats_current.remote_received_modeac++
That should be as good as any of the other counters to abuse for this particular testing case.
note that it’s actually “normal” to see real duplicate messages on the air - DF11 is the most obvious case (for a given aircraft, there’s almost no variable content in there)
25ms seems very long. If you’re looking for the same message being decoded repeatedly with slightly different sampling points then 5us should be more than enough?
Huh?
I was just looking for duplicate rate that comes out … as it might skew numbers for the stats comparing multiple decoders.
Anyhow be sure to reduce the allowed time difference.
While i didn’t see any duplicates so short after each other, what obj is saying makes sense
I could but the message hasn’t been error corrected at that point, just scored. That was just like putting it at the top of decodeModesMessage().
EDIT:
I could put it in decodeModesMessage() just after the call to correctMessage() and return a -3. I’d also have to add a new entry to the stats and update both demod_hirate and demod_2400 to check for teh -3 and increment the new counter.
I don’t really know where it would fit best or how you would best be able to check for it, was mostly a remark in regard to statistics.
Just nice to have no dupes in there.