From: Jan Michel Date: Fri, 16 Dec 2022 19:28:59 +0000 (+0100) Subject: threshold setting as decimal number X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=a269c0db3ce2024eeed67a37a7d9eb076ab9763c;p=hades_mdc_settings.git threshold setting as decimal number --- 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);