From: Jan Michel Date: Tue, 18 Jul 2023 11:57:31 +0000 (+0200) Subject: add no-save option for power cycles X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=035ae516202c2fab8be72d063d168ff23fee4292;p=hades_mdc_settings.git add no-save option for power cycles --- diff --git a/scripts/MDCPower.pm b/scripts/MDCPower.pm index 4ff4602..5c8ff15 100644 --- a/scripts/MDCPower.pm +++ b/scripts/MDCPower.pm @@ -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; } diff --git a/scripts/check_voltages.pl b/scripts/check_voltages.pl index 9bf5508..7a41797 100755 --- a/scripts/check_voltages.pl +++ b/scripts/check_voltages.pl @@ -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; } diff --git a/scripts/testpb.pl b/scripts/test/testpb.pl similarity index 73% rename from scripts/testpb.pl rename to scripts/test/testpb.pl index 3017eb8..a1fb004 100644 --- a/scripts/testpb.pl +++ b/scripts/test/testpb.pl @@ -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");