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