my ($host,$board,$outp) = MDC::get_power_output($addr);
return -2 unless defined $host && $board >= 0 && $outp >= 0;
- system("./mdc_powerboard.pl -d $host -b $board -o $outp -c $channel -r adjust -v $setting");
+ #system("./mdc_powerboard.pl -d $host -b $board -o $outp -c $channel -r adjust -v $setting");
+ $ret = powerboard_command($host,$board,$outp,$channel,'adjust',$setting);
+ print("Errorcode $ret\n") unless $ret == 1;
store_voltage($addr,$channel,$setting) if $save;
return 1;
if($rw eq 'W' && $answ == 0x00d1) {
return 1;
}
- elsif($rw == 1) {
+ elsif($rw eq 'W') {
return -10;
}
else {
$ret = ($answ&0xFFFF)*417/27*2.5/1000;
}
if($command == 3) { #Current
- $ret = ($answ&0xFFF)/800.*2.5; # 800mV/A
+ $ret = ($answ&0xFFF)/500.*2.5; # 500mV/A
}
if($command == 4 && $board == -1) { #Temperature PD
$ret = ($answ/100.);
* `pasttrec_baseline_finder.pl` basic baseline finder script
## Voltages
-* `mdc_voltage.pl` set voltages and update voltage database file
-* `mdc_powerboard.pl` send commands to MDC power board
+* `mdc_voltage.pl` set voltages and update voltage database file, switches boards on/off, based on addresses
+* `mdc_powerboard.pl` send commands to a MDC power board, based on raw device and channel numbers
* `check_voltages.pl` reads voltages and suggests changes
# Packages
if($help) {
print <<HELP;
+Reads the current voltage setting from configuration file.
+Sets the current voltage, optionally changes configuration file.
+Board needs to be a valid OEP address.
+
+Options
+=======
+ -b 0xnnnn Board address
+ -c (0|1) Channel number
+ -r (-7..7) relative change of setting
+ -v (0-7) absolute change of setting
+ -w write to configuration file
+ --on/--off switch power (power cycle if both are specified)
+ -l load settings from file
+
+
+
+Examples
+========
+
mdc_voltage.pl (-board|-b) 0xnnnn
display settings from file
mdc_voltage.pl (-load|-l)
load all settings from file to boards
-mdc_voltage.pl (-board|-b) 0x8nnn (-channel|c) (0|1) (-value|-v) (0-7)
+mdc_voltage.pl (-board|-b) 0x8nnn (-channel|-c) (0|1) (-value|-v) (0-7)
change setting on board only
-mdc_voltage.pl (-board|-b) 0x8nnn (-channel|c) (0|1) (-value|-v) (0-7) (-write|-w)
+mdc_voltage.pl (-board|-b) 0x8nnn (-channel|-c) (0|1) (-value|-v) (0-7) (-write|-w)
change setting on board and store in file
-mdc_voltage.pl (-board|-b) 0x8nnn (-channel|c) (0|1) (-relative|-r) (-7..7) [(-write|-w)]
+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.
HELP
--- /dev/null
+#!/usr/bin/perl -w
+use warnings;
+no warnings "portable";
+use Getopt::Long;
+use Data::Dumper;
+use Time::HiRes qw(usleep);
+use lib '.';
+use MDC;
+use MDCPower;
+
+
+# my($host,$board,$output,$channel,$command,$value)
+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");
+print(MDCPower::powerboard_command("192.168.0.12",0,0,0,"vin")."\n");