From a86e5461660d7041bf4d99ad3535df70a0507ce6 Mon Sep 17 00:00:00 2001 From: hadaq Date: Sun, 31 May 2020 07:20:03 +0200 Subject: [PATCH] add fix for differential fifo mode --- tools/hadplot | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/hadplot b/tools/hadplot index ca130e3..78ab050 100755 --- a/tools/hadplot +++ b/tools/hadplot @@ -573,6 +573,7 @@ Options: -m regamount Number of consecutive registers to show -z style Selects one of the possible styles (deprecated) -t title Name of the curve shown in key + -f fifomode -output expects a string "(PNG|SVG).\$filename.\$xsize.\$ysize" to write to a file -windowname Name of window (shown in titlebar after "Hadplot - " -timeref In a differential plot, the endpoint with this addressis used for timestamping @@ -775,6 +776,7 @@ sub genreg { $c = trb_register_read_mem(($address->[$i]),($register->[$i]),$fifomode->[$i],$regamount->[$i]) or die trb_strerror(); } foreach my $s (sort keys %$c) { + my $lasttmp; for(my $r = 0; $r < scalar @{$c->{$s}};$r++) { my $tmp = ($c->{$s}->[$r]>>$regoffset->[$i])&(2**$regwidth->[$i]-1); my $val = $tmp; @@ -782,7 +784,13 @@ sub genreg { my $reg = $register->[$i]+$r; if($ydiff) { - if(defined $oldvals{$i}->{$board.$reg}) { + if ($fifomode->[$i]) { + $val = $tmp - $lasttmp; + $val += 2**$regwidth->[$i] if $val < 0; + $lasttmp = $tmp; + next if $r == 0; + } + elsif(defined $oldvals{$i}->{$board.$reg}) { if ($oldvals{$i}->{$board.$reg} > $tmp) { $val = $tmp - $oldvals{$i}->{$board.$reg} + 2**$regwidth->[$i]; } -- 2.43.0