source: branches/testFACT++branch/scripts/handleBiasVoltageOff.js@ 18788

Last change on this file since 18788 was 18112, checked in by tbretz, 10 years ago
Fixed a typo in a log text.
File size: 1.4 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 case "Locked":
25 console.out("WARNING - Bias is LOCKED. Please report, this is serious, unlock manually and go on.");
26 return "";
27
28 // Do-something conditions
29 case "Disconnected":
30 console.out("Bias in Disconnected... connect.");
31 dim.send("BIAS_CONTROL/RECONNECT");
32 return "VoltageOff";
33
34 case "NotReferenced":
35 case "VoltageOn":
36 console.out("Bias in "+state.name+"... switch voltage off.");
37 dim.send("BIAS_CONTROL/SET_ZERO_VOLTAGE");
38 return "VoltageOff";
39
40 // Final state reached condition
41 case "VoltageOff":
42 return "";
43
44 // Conditions which cannot be handled
45 case "OverCurrent": throw "BIAS_CONTROL in OverCurrent";
46 case "ExpertMode": throw "BIAS_CONTROL in expert mode";
47 }
48
49 throw new Error("BIAS_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
50}
Note: See TracBrowser for help on using the repository browser.