From 0b759b78fa00e06ddad2271c11dab2d2acf1eea2 Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Wed, 30 Nov 2016 10:51:10 +0100 Subject: [PATCH] Power Supply Channels can have names in the GUI --- web/htdocs/tools/pwr/build_index.pl | 17 ++++++++++------- web/htdocs/tools/pwr/pwr_hmp.htm | 8 +++++++- web/htdocs/tools/pwr/pwr_switch.htm | 12 ++++++++---- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/web/htdocs/tools/pwr/build_index.pl b/web/htdocs/tools/pwr/build_index.pl index 8c6fa8f..0a449ef 100755 --- a/web/htdocs/tools/pwr/build_index.pl +++ b/web/htdocs/tools/pwr/build_index.pl @@ -22,11 +22,14 @@ open(LESEN,$file) while(defined(my $i = )) { if( $i =~ /^PWRSPLY:([^:]+):([^:]+):([^:]+):([^:]+):([^:]+)/g ) { - my $ser_dev=$1; - my $speed=$2; - my $dev_id=$3; - my $type=$4; - my $channels=$5; + my @arr = split(':',$i); + shift @arr; + my $ser_dev = shift @arr; + my $speed = shift @arr; + my $dev_id = shift @arr; + my $type = shift @arr; + my $channels = shift @arr; + my $names = join(':',@arr); if($type eq "PSP") { print < - +

EOF } @@ -47,7 +50,7 @@ EOF if($type =~ /PWRSW/) { print < - +

EOF } diff --git a/web/htdocs/tools/pwr/pwr_hmp.htm b/web/htdocs/tools/pwr/pwr_hmp.htm index 76dc1ba..8a59298 100644 --- a/web/htdocs/tools/pwr/pwr_hmp.htm +++ b/web/htdocs/tools/pwr/pwr_hmp.htm @@ -57,8 +57,10 @@ var dev_id = getParameterByName("id"); var type = getParameterByName("type"); var channels = getParameterByName("channels"); var speed = getParameterByName("speed"); +var names = getParameterByName("names"); var readSettingsRequest = 1; var forceShowReadings = 1; +var Vnames = names.split(':'); if (channels<2) { document.getElementById("chan2").style.color = "#eee"; @@ -224,7 +226,11 @@ function readSettings() { updateTask = setTimeout("update()",updaterate); document.getElementById("headline").innerHTML = "Power Supply "+''+dev_id+''+" [connected to "+''+ser_dev+''+"]" ; - + +for(i=1;i<=channels;i++) { + if(typeof Vnames[i-1] !== 'undefined') + document.getElementById("chan"+i).innerHTML = i+' - '+Vnames[i-1]; + } diff --git a/web/htdocs/tools/pwr/pwr_switch.htm b/web/htdocs/tools/pwr/pwr_switch.htm index 9ff228d..8ec0aea 100644 --- a/web/htdocs/tools/pwr/pwr_switch.htm +++ b/web/htdocs/tools/pwr/pwr_switch.htm @@ -15,11 +15,12 @@
- - + @@ -36,6 +37,7 @@ var dev_id = getParameterByName("id"); var type = getParameterByName("type"); var channels = getParameterByName("channels"); var speed = getParameterByName("speed"); +var names = getParameterByName("names"); var readSettingsRequest = 1; var forceUpdate = 1; @@ -44,11 +46,13 @@ var Vcurrent = new Array(); var Vaverage = new Array(); var Vlimit = new Array(); var Vdate = "x"; +var Vnames = names.split(':'); function maketable() { out = ""; for(i=0;i"; + if(typeof Vnames[i] !== 'undefined') out += Vnames[i]; if (Vstatus[i] == 1) { out += '
ChannelStatusCurrentAverageLimit +
ChannelStatusCurrentAverageLimit
Enable read-back of values - +
Enable read-back of values +
 
 '; } -- 2.43.0