###############################################################################
#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) = @_;
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;
}
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;
}
# 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");