From: Michael Traxler Date: Tue, 16 Jul 2013 14:18:59 +0000 (+0200) Subject: corrected web control for the power supply PST3202 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=0d77495e3a6093d995b79226e75b5374e102b8c5;p=daqtools.git corrected web control for the power supply PST3202 --- diff --git a/web/htdocs/tools/pwr/pwr.pl b/web/htdocs/tools/pwr/pwr.pl index 724f26a..3699b57 100755 --- a/web/htdocs/tools/pwr/pwr.pl +++ b/web/htdocs/tools/pwr/pwr.pl @@ -37,7 +37,7 @@ $port->parity("none"); $port->databits(8); $port->stopbits(1); $port->handshake("xoff"); -$port->handshake("none") if $ser_type eq "HMP"; +$port->handshake("none") if $ser_type eq "HMP" or $ser_type eq "PST"; $port->write_settings; # debug output @@ -154,20 +154,23 @@ sub receive_answer_HMP { while ( my $command = shift(@new_command) ) { $port->lookclear; usleep(1000); + usleep(20000) if $ser_type eq "PST"; $command = uri_unescape($command); $port->write("$command\r\n"); # print "i sent the command: $command\n"; #print "\n\nokay.\n"; usleep(1000); + usleep(20000) if $ser_type eq "PST"; if($command =~ m/\?/) { # print "waiting...\n"; READBACK: for (my $i = 0; ($i<500) ;$i++) { $a = $port->lookfor(3); - if ($a =~ m/\d/) { + if (defined $a and $a ne "" and $a =~ m/\d/) { print $a."&"; last READBACK; } usleep(1000); + usleep(20000) if $ser_type eq "PST"; } } else { diff --git a/web/htdocs/tools/pwr/pwr_hmp.htm b/web/htdocs/tools/pwr/pwr_hmp.htm index 777d2d1..b35773a 100644 --- a/web/htdocs/tools/pwr/pwr_hmp.htm +++ b/web/htdocs/tools/pwr/pwr_hmp.htm @@ -100,15 +100,15 @@ function set_c_lim(chan) { function turn_on(chan) { if (chan > channels) return; - if(type=="HMP") new_commands.push("INST OUT"+chan+"&OUTP ON"); - if(type=="PST") command = ":OUTP:STAT 1"; + if(type=="HMP") new_commands.push("INST OUT"+chan+"&OUTP ON"); + if(type=="PST") new_commands.push(":OUTP:STAT ON"); forceShowReadings = 1; } function turn_off(chan) { if (chan > channels) return; if(type=="HMP") new_commands.push("INST OUT"+chan+"&OUTP OFF"); - if(type=="PST") command = ":OUTP:STAT 0"; + if(type=="PST") new_commands.push(":OUTP:STAT OFF"); forceShowReadings = 1; } @@ -135,7 +135,7 @@ function updatesettings(data) { for(i=0;i