source: trunk/FACT++/scripts/handleLidClosed.js@ 16838

Last change on this file since 16838 was 16838, checked in by tbretz, 11 years ago
Try a CLOSE, if the LID is in the state 'Unknown' - might still need some interaction of the shifter.
File size: 829 bytes
Line 
1// Get Lids closed
2function handleLidClosed(wait_state)
3{
4 var state = dim.state("LID_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("LID_CONTROL: "+state.name+"["+state.index+"]");
12
13 switch (state.name)
14 {
15 // Do-nothing conditions
16 case "NoConnection":
17 case "Connected":
18 case "Moving":
19 return wait_state;
20
21 case "Unknown":
22 case "Inconsistent":
23 case "Open":
24 console.out("Lidctrl in '"+state.name+"'... sending CLOSE... waiting for 'Closed'.");
25 dim.send("LID_CONTROL/CLOSE");
26 return "Closed";
27
28 case "Closed":
29 return "";
30 }
31
32 throw new Error("LID_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
33}
Note: See TracBrowser for help on using the repository browser.