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

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