]> jspc29.x-matter.uni-frankfurt.de Git - hades_mdc_settings.git/commitdiff
add switch option for power
authorJan Michel <michel@physik.uni-frankfurt.de>
Fri, 3 Feb 2023 11:07:22 +0000 (12:07 +0100)
committerJan Michel <michel@physik.uni-frankfurt.de>
Fri, 3 Feb 2023 11:07:22 +0000 (12:07 +0100)
scripts/mdc_voltage.pl

index c2a4c255b9cd0d92d9904e3ce811580e9eee6a46..03d45ac319f0626c81246144916a138a11d24b2b 100755 (executable)
@@ -15,6 +15,8 @@ my $setting;
 my $write;
 my $load;
 my $relative;
+my $on;
+my $off;
 
 Getopt::Long::Configure(qw(gnu_getopt));
 GetOptions(
@@ -48,6 +50,9 @@ mdc_voltage.pl (-board|-b) 0x8nnn (-channel|c) (0|1) (-value|-v) (0-7) (-write|-
 mdc_voltage.pl (-board|-b) 0x8nnn (-channel|c) (0|1) (-relative|-r) (-7..7) [(-write|-w)]
         change setting relative to the setting in file
         
+mdc_voltage.pl (-board|-b) 0xnnnn (--on|--off)
+        switches board on/off
+        
 Reads the current voltage setting from configuration file.
 Sets the current voltage (optionally changes configuration file if -w is set).
 Board needs to be a valid OEP address, or FFFF to show/load all channels.
@@ -74,9 +79,16 @@ if(defined $setting && ($setting < 0 || $setting > 7)) {
 if(defined $relative && ($relative < -7 || $relative > 7)) {
   die "Wrong relative number (-7-7)\n";
   }  
+
+#Switch boards on/off
+if((defined $on || defined $off) && defined $board) {
+  if(defined $on && defined $off) {$on = 2;}
+  my $ret = MDCPower::power_switch($board,$on//0);
+  die "Board not found.\n" if $ret == -1;
+  }  
   
 #Load all settings  
-if(defined $load && !defined $board) {
+elsif(defined $load && !defined $board) {
   my $ret = MDCPower::set_all_voltages();
   }