diff --git a/files/www/cgi-bin/signal2 b/files/www/cgi-bin/signal2 index 5bca7e2b..580545b8 100755 --- a/files/www/cgi-bin/signal2 +++ b/files/www/cgi-bin/signal2 @@ -79,6 +79,7 @@ $header = < MAXPOINTS) { - // dps[0].shift(); - // dps[1].shift(); - //} + \$.getJSON("/cgi-bin/signal2.json?realtime=1&device=$parms{device}", function (result) { dps[0].push(result[0][0]); dps[1].push(result[1][0]); chart.render(); @@ -156,6 +153,42 @@ $page = <

$node


+
+
+ Selected Device: "; +$page = $page . "" if($parms{realtime} eq "1"); + +$page = $page . < +
diff --git a/files/www/cgi-bin/signal2.json b/files/www/cgi-bin/signal2.json index efe1de57..147003ff 100755 --- a/files/www/cgi-bin/signal2.json +++ b/files/www/cgi-bin/signal2.json @@ -42,24 +42,32 @@ use perlfunc; read_query_string(); my $debug = 0; -my $filename="/tmp/snrlog"; +my $dirname="/tmp/snrlog"; my @values; my $counter=0; my $sjson; my $njson; -system("touch $filename") unless (-f $filename); +system("mkdir $dirname") unless (-d $dirname); if($parms{"realtime"}) { # ==== REALTIME DATA ===== ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); - $d = sprintf ("%02d:%02d:%02d", $hour, $min, $sec); - ($s, $n) = get_wifi_signal(get_interface("wifi")); + $d = sprintf ("%02d:%02d:%02d", $hour, $min, $sec); + + #if($parms{device} eq '') { + ($s, $n) = get_wifi_signal(get_interface("wifi")); + #} + $sjson= sprintf("{\"label\":\"%s\",\"y\":%s}",$d,$s); $njson= sprintf("{\"label\":\"%s\",\"y\":%s}",$d,$n); } else { # ==== ARCHIVE DATA ===== # --- Load the snr data into an array + if($parms{device} == '') { $parms{device}="strongest"; } + + $filename=$dirname . "/" . $parms{device}; + open my $fh, '<', $filename or die "Could not open file '$filename' $!"; chomp(my @lines = <$fh>); close $fh;