source: trunk/FACT++/scripts/handleAgilentPowerOn.js@ 15761

Last change on this file since 15761 was 14968, checked in by tbretz, 12 years ago
Replaced dim.print by dim.log
File size: 936 bytes
Line 
1// switch agilent control output on
2function handleAgilentPowerOn(wait_state)
3{
4 var state = dim.state("AGILENT_CONTROL");
5 if (state===undefined)
6 return undefined;
7
8 if (wait_state && wait_state.length>0 && state.name!=wait_state)
9 return wait_state;
10
11 //dim.log("AGILENT_CONTROL: "+state.name+"["+state.index+"]");
12
13 switch (state.name)
14 {
15 case "Disconnected":
16 case "Connected":
17 return undefined;
18
19 case "VoltageLow":
20 return wait_state;
21
22 case "VoltageOff":
23 console.out("Agilent in VoltageOff... switching agilent output on.");
24 dim.send("AGILENT_CONTROL/SET_POWER", true);
25 return "VoltageOn";
26
27 case "VoltageOn":
28 return "";
29
30 case "VoltageHigh":
31 throw new Error("Agilent reports voltage above limit... please check.");
32 }
33
34 throw new Error("AGILENT_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
35}
Note: See TracBrowser for help on using the repository browser.