fixed web-page issues and threshold-script bugs. mt"
authorYour Name <you@example.com>
Tue, 14 Jun 2022 12:04:58 +0000 (14:04 +0200)
committerYour Name <you@example.com>
Tue, 14 Jun 2022 12:04:58 +0000 (14:04 +0200)
thresholds/set_fixed_threshold.pl
users/ufsd_trb3_sdalinac/second.C
users/ufsd_trb3_sdalinac/startup.sh
web/htdocs/commands/getpadiwa.pl
web/htdocs/padiwa/padiwa.htm

index 1ab1d8bcd5af74c4fe1e5f2fad288e930cb38695..40e7485bc6540480a4f5dd69adfff8abad8e69fc 100755 (executable)
@@ -49,7 +49,11 @@ if($chain =~ /^0x/) {
 trb_init_ports() or die trb_strerror();
 
 
-foreach my $channel (0..15) {
+my $max_number_of_channels = 15;
+
+$max_number_of_channels = 31 if($mode eq "dirich2");
+
+foreach my $channel (0..$max_number_of_channels) {
   write_threshold($mode, $endpoint, $chain, $channel, $value);
 }
 
index 91eb1ebdf934116874f968a93b9e6dbd2e607629..4ec9e44b4815f21685c2700ab84aa2294460767e 100644 (file)
@@ -4,6 +4,7 @@
 #include <sstream>
 #include <fstream>
 #include <vector>
+#include <array>
 
 #include "base/EventProc.h"
 #include "base/Event.h"
@@ -220,5 +221,5 @@ class SecondProc : public base::EventProc
 
 void second()
 {
-    new SecondProc("TEST", "TDC_1405", "TDC_1410", "TDC_1411", "TDC_1415");
+    new SecondProc("TEST", "TDC_1401", "TDC_1405", "TDC_1407", "TDC_1408");
 }
index 2d6019f965b11e78542800de9d3db97354f822ef..e1fc5ccf8536708718d97effbe06119af0a34568 100755 (executable)
@@ -101,7 +101,14 @@ echo "trigger type"
 #trbcmd clearbit 0x1130 0xc801 0x80000000 # disable window
 #trbcmd w 0x1130 0xc802 0xffff0000 # enable upper 16 channels for padiwa
 #trbcmd w 0x1580 0xc802 0xffffffff # enable upper 16 channels for padiwa
+# activate 32 channels of every TDC
+trbcmd w 0xfe57  0xc802 0xffffffff 
 
+# set the trigger-out signal width for all TDCs, 0x2 is about 20ns 
+trbcmd w 0xfe57 0xe000 0x4
+
+# activate all trigger-out signals 
+trbcmd w 0xfe57 0xe002 0xffffffff
 
 cd ~/trbsoft/daqtools/xml-db
 ./put.pl Readout 0xfe51 SetMaxEventSize 500
index 97bca36aec72d9f8ff7aeed8acc1c333d29124d9..ffa326fd4bf1696e100ab4743f13b9f96a1359cb 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/perl
 use HADES::TrbNet;
 use warnings;
+use Dmon;
+use Time::HiRes qq|usleep|;
 #use strict;
 # use Data::Dumper;
 if (defined $ENV{'SERVER_SOFTWARE'} && $ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) {
@@ -8,14 +10,15 @@ if (defined $ENV{'SERVER_SOFTWARE'} && $ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) {
   print "Content-type: text/html\r\n\r\n";
 }
 else {
-  use lib '..';
+  #use lib '..';
   #use apacheEnv;
   #use if (!($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i)), apacheEnv;
   print "Content-type: text/html\n\n";
 }
 
+
 if (!defined trb_init_ports()) {
-  print stderr "can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}.\n";
+  print STDERR "can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}.\n";
   die trb_strerror();
 }
 
@@ -32,19 +35,22 @@ if(!defined $board || !defined $task) {
 }
 $board = hex($board);
 
-
 sub sendcmd {
   my ($cmd,$chain) = @_;
+  return Dmon::PadiwaSendCmd($cmd, $board, $chain);
+  # all the rest is old
   my $c = [$cmd,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1<<$chain,0x10001];
   my $errcnt = 0;
   while(1) {
     trb_register_write_mem($board,0xd400,0,$c,scalar @{$c});
+
+    if (trb_strerror() =~ "no endpoint has been reached") {return -1;}
     if (trb_strerror() ne "No Error") {
-      sleep 1;
-      if($errcnt >= 5) {
+      #sleep 1; usleep 3E4;
+      if($errcnt >= 12) {
         die "SPI still blocked\n";
       }
-      elsif($errcnt++ >= 6) {
+      elsif($errcnt++ >= 10) {
         trb_register_read($board,0xd412);
       }
     }
index 5cfcf9d0035b1b1928f544c5d11d918158367591..963f7ab460879b5583b2d6b3c5aa5c7c22ea4db0 100644 (file)
@@ -122,7 +122,7 @@ function update(data) {
                   valmV  = "---";
                   col = findcolor((val),0x6500,0x9000,0);
                   valhex = (val.toString(16));
-                  valmV  = (val*35E-3).toString(10).slice(0,7);
+                  valmV  = (val*38.14697E-3).toString(10).slice(0,7);
                   o += "<span class=\"fixed\" style=\"background:"+col+"\">"+valhex+" "+valmV+"mV"+"</span><br>";
                   //console.log(o);
               }