- # per second (limited by the test program's output and network speed, rather than DXSpider's handling).
-
- my $p = "$t|$call";
- ++$self->{noraw};
- return if $d->{$p};
-
- # new RBN input
- $d->{$p} = $tim;
- ++$self->{norbn};
- $qrg = sprintf('%.1f', nearest(.1, $qrg)); # to nearest 100Hz (to catch the odd multiple decpl QRG [eg '7002.07']).
- if (isdbg('rbnraw')) {
- my $ss = join(',', "RBN", $origin, $qrg, $call, $mode, $s, $m, $spd, $u, $sort, $t);
- $ss .= ",$b" if $b;
- dbg "RBNRAW:$ss";
- }
-
- # Determine whether to "SPOT" it based on whether we have not seen it before (near this QRG) or,
- # if we have, has it been a "while" since the last time we spotted it? If it has been spotted
- # before then "RESPOT" it.
- my $nqrg = nearest(1, $qrg); # normalised to nearest Khz
- my $sp = "$call|$nqrg"; # hopefully the skimmers will be calibrated at least this well!
- my $ts = $spot->{$sp};
-
- if (!$ts || ($self->{minspottime} > 0 && $tim - $ts >= $self->{minspottime})) {
- ++$self->{nospot};
- my $tag = $ts ? "RESPOT" : "SPOT";
- $t .= ",$b" if $b;
-
- my ($hh,$mm) = $t =~ /(\d\d)(\d\d)Z$/;
- my $utz = str2time(sprintf('%02d:%02dZ', $hh, $mm));
- dbg "RBN:" . join(',', $tag, $origin, $qrg, $call, $mode, $s, $m, $spd, $u, $sort, $t) if dbg('rbn');
-
-
- my @s = Spot::prepare($qrg, $call, $utz, sprintf("%-5s%3d $m", $mode, $s), $origin);
-
- if (isdbg('progress')) {
- my $d = ztime($s[2]);
- my $s = "RBN: $s[1] on $s[0] \@ $d by $s[4]";
- $s .= $s[3] ? " '$s[3]'" : q{ ''};
- $s .= " route: $self->{call}";
- dbg($s);
+ # per second (limited by the test program's output and network speed, rather than DXSpider's handling).
+
+ my $nqrg = nearest(5, $qrg*10); # normalised to nearest .5 Khz (but multipled by 10 to get an integer)
+# my $nqrg = nearest_even($qrg); # normalised to nearest Khz
+ my $sp = "$call|$nqrg"; # hopefully the skimmers will be calibrated at least this well!
+ my $spp = sprintf("$call|%d", $nqrg+1); # but, clearly, my hopes are rudely dashed
+ my $spm = sprintf("$call|%d", $nqrg-1); # in BOTH directions!
+
+ # do we have it?
+ my $cand = $spots->{$sp};
+ $cand = $spots->{$spp}, $sp = $spp, dbg(qq{RBN: SPP using $spp for $sp}) if isdbg('rbn') && !$cand && exists $spots->{$spp};
+ $cand = $spots->{$spm}, $sp = $spm, dbg(qq{RBN: SPM using $spm for $sp}) if isdbg('rbn') && !$cand && exists $spots->{$spm};
+
+ # if we have one and there is only one slot and that slot's time isn't expired for respot then return
+ my $respot = 0;
+ if ($cand && ref $cand) {
+ if (@$cand <= CEMPTY) {
+ unless ($self->{minspottime} > 0 && $tim - $cand->[0] >= $self->{minspottime}) {
+ dbg("RBN: key: '$sp' call: $call qrg: $qrg DUPE \@ ". atime(int $cand->[0])) if isdbg('rbn');
+ return;
+ }
+
+ dbg("RBN: key: '$sp' RESPOTTING call: $call qrg: $qrg last seen \@ ". atime(int $cand->[0])) if isdbg('rbn');
+ undef $cand; # it's about to be recreated (in one place)
+ ++$respot;