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

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