From c4ed2cb1dd09580627bddc2c8e551dc3e67a4987 Mon Sep 17 00:00:00 2001
From: Jan Michel
Date: Fri, 12 Jul 2013 20:09:34 +0200
Subject: [PATCH] more options to the power supply config file
---
web/htdocs/index.html | 2 +-
web/htdocs/tools/pwr/build_index.pl | 13 +++++++------
web/htdocs/tools/pwr/pwr.conf | 6 +++---
web/htdocs/tools/pwr/pwr.pl | 9 ++++++---
web/htdocs/tools/pwr/pwr_hmp.htm | 23 ++++++++++++++++++-----
5 files changed, 35 insertions(+), 18 deletions(-)
diff --git a/web/htdocs/index.html b/web/htdocs/index.html
index 2b0c8bf..4a2e2a1 100755
--- a/web/htdocs/index.html
+++ b/web/htdocs/index.html
@@ -47,7 +47,7 @@ The main documentation of the network can be found in these two documents:
Further Tools
diff --git a/web/htdocs/tools/pwr/build_index.pl b/web/htdocs/tools/pwr/build_index.pl
index 62af2e4..efcfa57 100755
--- a/web/htdocs/tools/pwr/build_index.pl
+++ b/web/htdocs/tools/pwr/build_index.pl
@@ -10,16 +10,17 @@ open(LESEN,"htdocs/tools/pwr/pwr.conf")
while(defined(my $i = )) {
- if( $i =~ /^PWRSPLY:([^:]+):([^:]+):([^:]+):([^:]+)/g ) {
+ if( $i =~ /^PWRSPLY:([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)/g ) {
my $ser_dev=$1;
- my $dev_id=$2;
- my $type=$3;
- my $channels=$4;
+ my $speed=$2;
+ my $dev_id=$3;
+ my $type=$4;
+ my $channels=$5;
if($type eq "PSP") {
print <
-
+
EOF
}
@@ -27,7 +28,7 @@ EOF
if($type =~ /HMP/) {
print <
-
+
EOF
}
diff --git a/web/htdocs/tools/pwr/pwr.conf b/web/htdocs/tools/pwr/pwr.conf
index d7aad6d..e23ad05 100644
--- a/web/htdocs/tools/pwr/pwr.conf
+++ b/web/htdocs/tools/pwr/pwr.conf
@@ -1,4 +1,4 @@
-//PWRSPLY:/path/to/device:Device_ID:Type:Channels
+//PWRSPLY:/path/to/device:speed:Name:Type:Channels
//type can be HMP, PSP
-PWRSPLY:/dev/ttyUSB0:PWR_DEFAULT:HMP:3
-PWRSPLY:/dev/ttyUSB1:PWR_OLD:PSP:1
\ No newline at end of file
+PWRSPLY:/dev/ttyUSB0:38400:HMP4030:HMP:3
+PWRSPLY:/dev/ttyUSB1:2400:PSP-405:PSP:1
\ No newline at end of file
diff --git a/web/htdocs/tools/pwr/pwr.pl b/web/htdocs/tools/pwr/pwr.pl
index 676e1d5..5363c53 100755
--- a/web/htdocs/tools/pwr/pwr.pl
+++ b/web/htdocs/tools/pwr/pwr.pl
@@ -20,6 +20,10 @@ $ser_dev = "/dev/ttyUSB0" unless defined $ser_dev;
my $ser_type = shift(@new_command);
$ser_type = "PSP" unless defined $ser_type;
+my $ser_speed = shift(@new_command);
+$ser_speed = "2400" unless defined $ser_speed;
+
+
my $port = new Device::SerialPort($ser_dev);
unless ($port)
{
@@ -28,8 +32,7 @@ unless ($port)
}
$port->user_msg('ON');
-$port->baudrate(2400) if $ser_type eq "PSP";
-$port->baudrate(115200) if $ser_type eq "HMP";
+$port->baudrate($ser_speed);
$port->parity("none");
$port->databits(8);
$port->stopbits(1);
@@ -154,7 +157,7 @@ sub receive_answer_HMP {
$port->write("$command\r\n");
# print "i sent the command: $command\n";
#print "\n\nokay.\n";
- usleep 1E5;
+ usleep 5E4;
while(my $a = $port->lookfor) {
print $a."&"; # debug output
}
diff --git a/web/htdocs/tools/pwr/pwr_hmp.htm b/web/htdocs/tools/pwr/pwr_hmp.htm
index c9b402b..036f774 100644
--- a/web/htdocs/tools/pwr/pwr_hmp.htm
+++ b/web/htdocs/tools/pwr/pwr_hmp.htm
@@ -15,7 +15,7 @@