diff --git a/files/www/cgi-bin/signal b/files/www/cgi-bin/signal
index 95fe9e28..7d6ccfe2 100755
--- a/files/www/cgi-bin/signal
+++ b/files/www/cgi-bin/signal
@@ -165,22 +165,21 @@ EOF
my @files = `ls -1A /tmp/snrlog`;
$parms{device}="" if(!/$parms{device}/ ~~ @files);
-# default to "Strongest Signal"
-if($parms{device}) {
- $page = $page . "";
-} else {
+# default to "Strongest Signal" for Realtime
+if(! $parms{device} and $parms{realtime}) {
$page = $page . "";
-}
+}
+$firstSel=1;
# iterate over each file
foreach $logfile (@files)
{
chomp($logfile);
- next if($logfile eq 'strongest');
my ($dmac, $dname) = $logfile =~ /^(.*?)\-(.*)/;
- $dname=$logfile if($dname eq '');
- if($parms{device} eq $logfile) {
+ $dname=$dmac if($dname eq '');
+ if($parms{device} eq $logfile or (!$parms{realtime} and $firstSel)) {
$page = $page . "\n";
+ $firstSel=0;
} else {
$page = $page . "\n";
}
diff --git a/files/www/cgi-bin/signal.json b/files/www/cgi-bin/signal.json
index db53a286..051e8820 100755
--- a/files/www/cgi-bin/signal.json
+++ b/files/www/cgi-bin/signal.json
@@ -67,7 +67,7 @@ if($parms{"realtime"}) {
} else {
# ==== ARCHIVE DATA =====
# --- Load the snr data into an array
- if($parms{device} eq '') { $parms{device}="strongest"; }
+ if($parms{device} eq '') { chomp ($parms{device}=`ls -1A $dirname | head -1`); }
$filename=$dirname . "/" . $parms{device};
open my $fh, '<', $filename or die "Could not open file '$filename' $!";
@@ -123,4 +123,4 @@ sub get_realtime_signal()
}
($junk, $n) = get_wifi_signal(get_interface("wifi"));
return ($s, $n);
-}
\ No newline at end of file
+}