Skip to content

Commit 5e1ae7d

Browse files
committed
Remove duplicate WSPR messages
1 parent 8f20165 commit 5e1ae7d

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

  • AudioCoder/src/main/java/org/operatorfoundation/audiocoder

AudioCoder/src/main/java/org/operatorfoundation/audiocoder/WSPRStation.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,21 @@ class WSPRStation(
363363
{
364364
if (nativeResults == null) return emptyList()
365365

366-
nativeResults.forEach { msg ->
366+
// Deduplicate on callsign+grid+power — SNR and freq offset are
367+
// measurement artifacts that wsprd reports per drift estimate
368+
val uniqueResults = nativeResults
369+
.distinctBy { Triple(it.call?.trim(), it.loc?.trim(), it.power) }
370+
371+
if (uniqueResults.size < nativeResults.size)
372+
{
373+
Timber.d("Deduplicated ${nativeResults.size} results to ${uniqueResults.size}")
374+
}
375+
376+
uniqueResults.forEach { msg ->
367377
Timber.d("NATIVE-RAW: call='${msg.call}', loc='${msg.loc}', power=${msg.power}, snr=${msg.snr}, message='${msg.message}'")
368378
}
369379

370-
return nativeResults.map { nativeMessage ->
380+
return uniqueResults.map { nativeMessage ->
371381
WSPRDecodeResult(
372382
callsign = nativeMessage.call?.trim() ?: WSPRDecodeResult.UNKNOWN_CALLSIGN,
373383
gridSquare = nativeMessage.loc?.trim() ?: WSPRDecodeResult.UNKNOWN_GRID_SQUARE,

0 commit comments

Comments
 (0)