source: trunk/FACT++/scripts/handleDriveArmed.js@ 16336

Last change on this file since 16336 was 16099, checked in by tbretz, 12 years ago
Skip the message in the log stream.
File size: 1.4 KB
Line 
1// Get Drive control armed
2function handleDriveArmed(wait_state)
3{
4 var state = dim.state("DRIVE_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("DRIVE_CONTROL: "+state.name+"["+state.index+"]");
12
13 switch (state.name)
14 {
15 case "Disconnected":
16 case "Connected":
17 case "NotReady":
18 case "Ready":
19 v8.sleep(1000);
20 return undefined;
21
22 case "Locked":
23 //console.warn("Drive is LOCKED. Not all observation types will be supported.");
24 console.out("WARNING - Drive is LOCKED. Please unlock manually.");
25 return "";
26 //throw new Error("Drive is LOCKED. Please unlock manually.");
27 //return undefined;
28 //dim.log("Drive in Locked... unlock.");
29 //dim.send("DRIVE_CONTROL/UNLOCK");
30 //return "Armed";
31
32 case "Moving":
33 case "Tracking":
34 case "OnTrack":
35 dim.log("Drive moving... stop.");
36 dim.send("DRIVE_CONTROL/STOP");
37 return "Armed";
38
39 case "ERROR":
40 dim.log("Drive in error... trying to reinitialize.");
41 dim.send("DRIVE_CONTROL/STOP");
42 dim.wait("DRIVE_CONTROL", "Armed", 5000);
43 return undefined; // Process that again if necessary
44
45 case "Armed":
46 return "";
47 }
48
49 throw new Error("DRIVE_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
50}
Note: See TracBrowser for help on using the repository browser.