]> jspc29.x-matter.uni-frankfurt.de Git - hades_mdc_settings.git/commitdiff
add no-save option for power cycles
authorJan Michel <michel@physik.uni-frankfurt.de>
Tue, 18 Jul 2023 11:57:31 +0000 (13:57 +0200)
committerJan Michel <michel@physik.uni-frankfurt.de>
Tue, 18 Jul 2023 11:57:31 +0000 (13:57 +0200)
scripts/MDCPower.pm
scripts/check_voltages.pl
scripts/test/testpb.pl [moved from scripts/testpb.pl with 73% similarity]

index 4ff4602f853db1da64e2db5c183abbe6e8a160e1..5c8ff15ba5ab1974b43d7cc46ee9d5018ab87bcf 100644 (file)
@@ -126,7 +126,7 @@ sub get_voltage {
 
 ###############################################################################  
 #switch on/off a specified board
-#onoff=2 does a quick power cycle
+#onoff=2 does a quick power cycle, without writing to EEPROM
 ###############################################################################
 sub power_switch {
   my ($addr,$onoff) = @_;
@@ -135,12 +135,12 @@ sub power_switch {
   return -1 unless defined $host && $board >= 0 && $outp >= 0;
   my $ret = 0;
   if($onoff == 0 || $onoff == 2) {
-    $ret = powerboard_command($host,$board,$outp,0,'switch',0);
+    $ret = powerboard_command($host,$board,$outp,0,'switch',0 + ($onoff==2?0x8000:0));
     print("Errorcode $ret\n") unless $ret == 1;
     }
   sleep(1)  if($onoff == 2);
   if($onoff == 1 || $onoff == 2) {
-    $ret = powerboard_command($host,$board,$outp,0,'switch',1;
+    $ret = powerboard_command($host,$board,$outp,0,'switch',1 + ($onoff==2?0x8000:0));
     print("Errorcode $ret\n") unless $ret == 1;
     }
 
index 9bf5508a802c27df49f85d889793c86b85cf22ae..7a41797275350dcb97c2497a5381a823b1dc177d 100755 (executable)
@@ -71,7 +71,7 @@ foreach my $b (sort keys %{$values}) {
 
 sub makechange {
   my ($b,$v,$c,$r) = @_;
-  my $cmd = sprintf("./mdc_voltage.pl -w -b 0x%04x\t-c %i\t-r %i\t#%i mV\n",$b,$c,$r,$v);
+  my $cmd = sprintf(" ./mdc_voltage.pl -w -b 0x%04x\t-c %i\t-r %i\t#%i mV\n",$b,$c,$r,$v);
   print $cmd;
   qx($cmd) if defined $execute;
   }
similarity index 73%
rename from scripts/testpb.pl
rename to scripts/test/testpb.pl
index 3017eb871e631684eba4f29d9d786192f3968c90..a1fb004176f2ee100111b301e40cb37f82f97032 100644 (file)
@@ -10,6 +10,13 @@ use MDCPower;
 
 
 #   my($host,$board,$output,$channel,$command,$value)
+
+# while(1) {
+print(MDCPower::powerboard_command("192.168.0.12",0,0,0,"curr")."\n");
+#   sleep 5;
+#   }
+
+print(MDCPower::powerboard_command("192.168.0.12",0,1,0,"switch",1)."\n");
 print(MDCPower::powerboard_command("192.168.0.12",-1,0,0,"temp")."\n");
 print(MDCPower::powerboard_command("192.168.0.12",0,0,0,"temp")."\n");
 print(MDCPower::powerboard_command("192.168.0.12",0,0,0,"curr")."\n");