From 8834e11a87965fec648898a7b8de9678c2bd4930 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 6 Dec 2009 14:55:31 -0800 Subject: [PATCH] when streaming, don't plot unless there's new data Ignore-this: ad73a697f4fdff7f269321aab8ea78f9 darcs-hash:20091206225531-0cb85-8951ac75504fb61c7ee2e9c7b20fae76f8fe4196.gz --- driveGnuPlots.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/driveGnuPlots.pl b/driveGnuPlots.pl index 285d2a7..bde67df 100755 --- a/driveGnuPlots.pl +++ b/driveGnuPlots.pl @@ -189,11 +189,14 @@ sub mainThread { # regexp for a possibly floating point, possibly scientific notation number, fully captured my $numRE = qr/([-]?[0-9\.]+(?:e[-]?[0-9]+)?)/o; my $xlast; + my $haveNewData; while( $_ = ($dataQueue && $dataQueue->dequeue()) // <> ) { if($_ ne "Plot now") { + $haveNewData = 1; + # parse the incoming data lines. The format is # x idx0 dat0 idx1 dat1 .... # where idxX is the index of the curve that datX corresponds to @@ -217,6 +220,9 @@ sub mainThread { elsif($options{"stream"} && defined $xlast) { + next unless $haveNewData; + $haveNewData = undef; + cutOld($xlast - $xwindow); plotStoredData($xlast - $xwindow, $xlast); }