]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
corrected web control for the power supply PST3202
authorMichael Traxler <hadaq@kp1pc105.gsi.de>
Tue, 16 Jul 2013 14:18:59 +0000 (16:18 +0200)
committerMichael Traxler <hadaq@kp1pc105.gsi.de>
Tue, 16 Jul 2013 14:18:59 +0000 (16:18 +0200)
web/htdocs/tools/pwr/pwr.pl
web/htdocs/tools/pwr/pwr_hmp.htm

index 724f26a3a51c53daf4caab6ea3d808c3ebbb603d..3699b5734352a41013c327080aac18ac1df128e3 100755 (executable)
@@ -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 {
index 777d2d1f7c03f5b913de34b0e31fd6fb67f580cb..b35773a671f29915e84356b570346c8e08f975fe 100644 (file)
@@ -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<channels;i++) {
     document.getElementById("form_v"+(i+1)).value=e[i*3];
     document.getElementById("form_c_lim"+(i+1)).value=e[i*3+1];
-    document.getElementById("form_v_lim"+(i+1)).value=e[i*3+1];
+    document.getElementById("form_v_lim"+(i+1)).value=e[i*3+2];
     }
   updateTask = setTimeout("communication()",updaterate);
   }    
@@ -153,7 +153,7 @@ function communication() {
         cmds +="&INST OUT"+i+"&SOUR:VOLT%3F&SOUR:CURR%3F&VOLT:PROT%3F";
       }
     if(type=="PST") {
-      cmd="%2AIDN%3F";
+      cmds="&%2AIDN%3F";
       for(i=1;i<=channels;i++)
         cmds +="&:CHAN"+i+":VOLT%3F&:CHAN"+i+":CURR%3F&:CHAN"+i+":PROT:VOLT%3F";
       }