]> jspc29.x-matter.uni-frankfurt.de Git - hadesdaq.git/commitdiff
changed algo of load_thresholds: now the order of the text table xxx.db is preserved, mt
authorHadaq Hades <jan@lxhadeb07>
Sun, 20 Dec 2020 20:32:56 +0000 (21:32 +0100)
committerHadaq Hades <jan@lxhadeb07>
Sun, 20 Dec 2020 20:32:56 +0000 (21:32 +0100)
main/startup.pl

index d595c7b4180c6eb6848145c118fc97bcd8cd16cf..8b9c69776dd7821ae9af2b8fe03eabf527b004ff 100755 (executable)
@@ -1127,7 +1127,7 @@ sub makeRegisterConf() {
 
   my %reg_hash;
   my $reg_href = \%reg_hash;
-
+  my @load_array = ();
   my $fh = new FileHandle( "$register", "r" );
   &isItDefined( $fh, $register );
 
@@ -1207,7 +1207,9 @@ sub makeRegisterConf() {
         my $reg = @{ $mb_type->{$type} }[$i];
         my $val = $val[$i];
 
-        push( @{ $reg_hash{$addr} }, { $reg => $val } );
+        #push( @{ $reg_hash{$addr} }, { $reg => $val } );
+        push( @load_array, { "$addr" => { $reg => $val }} );
+
       }
     }
     elsif ($ver_table) {
@@ -1227,14 +1229,20 @@ sub makeRegisterConf() {
 
   $fh = new FileHandle(">$outConf_register") || die "could not open $outConf_register";
 
-  foreach my $addr ( sort keys %{$reg_href} ) {
-    foreach my $ref ( @{ $reg_href->{$addr} } ) {
-      my ( $reg, $thr ) = each( %{$ref} );
-
-      print $fh "w $addr $reg $thr\n";
-    }
+  foreach my $cur_element ( @load_array ) {
+    (my $addr) = keys %$cur_element;
+    my $db = $cur_element->{$addr};
+    my ( $reg, $thr ) = each( %{$cur_element->{$addr}} );
+    print $fh "w $addr $reg $thr\n";
   }
 
+  #foreach my $addr ( sort keys %{$reg_href} ) {
+  #  foreach my $ref ( @{ $reg_href->{$addr} } ) {
+  #    my ( $reg, $thr ) = each( %{$ref} );
+  #     print $fh "w $addr $reg $thr\n";
+  #  }
+  #}
+
   $fh->close;
 
   return $ret_register;