source: trunk/FACT++/scripts/handleBiasVoltageOff.js@ 17050

Last change on this file since 17050 was 16857, checked in by tbretz, 11 years ago
Added the 'use strict'
File size: 1.2 KB
Line 
1'use strict';
2
3// Get bias control connected and voltage off
4function handleBiasVoltageOff(wait_state)
5{
6 var state = dim.state("BIAS_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("BIAS_CONTROL: "+state.name+"["+state.index+"]");
14
15 switch (state.name)
16 {
17 // Do-nothing conditions
18 case "Connecting":
19 case "Initializing":
20 case "Connected":
21 case "Ramping":
22 return wait_state;
23
24 // Do-something conditions
25 case "Disconnected":
26 console.out("Bias in Diconnected... connect.");
27 dim.send("BIAS_CONTROL/RECONNECT");
28 return "VoltageOff";
29
30 case "NotReferenced":
31 case "VoltageOn":
32 console.out("Bias in "+state.name+"... switch voltage off.");
33 dim.send("BIAS_CONTROL/SET_ZERO_VOLTAGE");
34 return "VoltageOff";
35
36 // Final state reached condition
37 case "VoltageOff":
38 return "";
39
40 // Conditions which cannot be handled
41 case "OverCurrent": throw "BIAS_CONTROL in OverCurrent";
42 case "ExpertMode": throw "BIAS_CONTROL in expert mode";
43 }
44
45 throw new Error("BIAS_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
46}
Note: See TracBrowser for help on using the repository browser.