source: trunk/FACT++/scripts/handlePwrCameraOn.js@ 16475

Last change on this file since 16475 was 16052, checked in by tbretz, 12 years ago
Handle the case NoConnection
File size: 1.3 KB
Line 
1// Switch interlock camera power on
2function handlePwrCameraOn(wait_state)
3{
4 var state = dim.state("PWR_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("PWR_CONTROL: "+state.name+"["+state.index+"]");
12
13 switch (state.name)
14 {
15 // Do-nothing conditions
16 case "Disconnected":
17 case "Connected":
18 case "NoConnection":
19 return undefined;
20
21 // Drive off
22 case "PowerOff":
23 console.out("Pwr in PowerOff... switching camera power on.");
24 dim.send("PWR_CONTROL/CAMERA_POWER", true);
25 return "DriveOff";
26
27 // Drive on
28 case "DriveOn":
29 console.out("Pwr in DriveOn... switching camera power on.");
30 dim.send("PWR_CONTROL/CAMERA_POWER", true);
31 return "SystemOn";
32
33 // Intermediate states?
34 case "CameraOn":
35 case "BiasOn":
36 case "CameraOff":
37 case "BiasOff":
38 return wait_state;
39
40 case "DriveOff":
41 case "SystemOn":
42 // Now the agilent control need to be switched on!
43 return "";
44
45 case "CoolingFailure":
46 throw new Error("Cooling unit reports failure... please check.");
47 }
48
49 throw new Error("PWR_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
50}
Note: See TracBrowser for help on using the repository browser.