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

Last change on this file since 20115 was 19511, checked in by tbretz, 5 years ago
The status 'UpperClosing' was unhandled.
File size: 953 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 case "UpperClosing":
24 return wait_state;
25
26 case "Unknown":
27 case "Inconsistent":
28 case "PowerProblem":
29 case "Open":
30 case "Opening":
31 console.out("Lidctrl in '"+state.name+"'... sending CLOSE... waiting for 'Closed'.");
32 dim.send("LID_CONTROL/CLOSE");
33 return "Closed";
34
35 case "Closed":
36 return "";
37 }
38
39 throw new Error("LID_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
40}
Note: See TracBrowser for help on using the repository browser.