From a269c0db3ce2024eeed67a37a7d9eb076ab9763c Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Fri, 16 Dec 2022 20:28:59 +0100 Subject: [PATCH] threshold setting as decimal number --- scripts/pasttrec_set_threshold.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/pasttrec_set_threshold.pl b/scripts/pasttrec_set_threshold.pl index 70e92b7..7add8d2 100755 --- a/scripts/pasttrec_set_threshold.pl +++ b/scripts/pasttrec_set_threshold.pl @@ -6,10 +6,13 @@ use Time::HiRes; my $threshold = $ARGV[0]; trb_init_ports() or die trb_strerror(); -trb_init_ports() or die trb_strerror(); + +if($threshold < 0 || $threshold > 127) { + die "not in valid range 0..127\n"; + } foreach my $pt (0..3) { - trb_register_write(0xfe91,0xa200+($pt << 4)+3,0x50300+hex($threshold)); - } + trb_register_write(0xfe91,0xa200+($pt << 4)+3,0x50300+$threshold); + } printf(" Threshold %i set to all available PASTTRECs. \n", $threshold); -- 2.43.0