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

Last change on this file since 19466 was 19466, checked in by tbretz, 7 years ago
Opening wasn't handled.
File size: 928 bytes
Line 
1'use strict';
2
3// Get Lids closed
4function handleLidClosed(wait_state)
5{
6 var state = dim.state("LID_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("LID_CONTROL: "+state.name+"["+state.index+"]");
14
15 switch (state.name)
16 {
17 // Do-nothing conditions
18 case "NotReady":
19 case "Ready":
20 case "NoConnection":
21 case "Connected":
22 case "Moving":
23 return wait_state;
24
25 case "Unknown":
26 case "Inconsistent":
27 case "PowerProblem":
28 case "Open":
29 case "Opening":
30 console.out("Lidctrl in '"+state.name+"'... sending CLOSE... waiting for 'Closed'.");
31 dim.send("LID_CONTROL/CLOSE");
32 return "Closed";
33
34 case "Closed":
35 return "";
36 }
37
38 throw new Error("LID_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
39}
Note: See TracBrowser for help on using the repository browser.