Last change
on this file since 19882 was 18396, checked in by Daniela Dorner, 9 years ago |
changed state from Armed to Initialized
|
File size:
1.6 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | // Get Drive control armed
|
---|
4 | function handleDriveArmed(wait_state)
|
---|
5 | {
|
---|
6 | var state = dim.state("DRIVE_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("DRIVE_CONTROL: "+state.name+"["+state.index+"]");
|
---|
14 |
|
---|
15 | switch (state.name)
|
---|
16 | {
|
---|
17 | case "Disconnected":
|
---|
18 | console.out("Drivectrl in 'Disconnected'... sending RECONNECT... waiting for 'Initialized'.");
|
---|
19 | dim.send("DRIVE_CONTROL/RECONNECT");
|
---|
20 | return "Initialized";
|
---|
21 |
|
---|
22 | case "Connected":
|
---|
23 | case "Parking":
|
---|
24 | case "Stopping":
|
---|
25 | case "Armed":
|
---|
26 | case "Blocked":
|
---|
27 | v8.sleep(1000);
|
---|
28 | return undefined;
|
---|
29 |
|
---|
30 | case "Locked":
|
---|
31 | console.out("WARNING - Drive is LOCKED. Please unlock manually.");
|
---|
32 | // Do NOT unlock the drive here... it is a safety feature which should
|
---|
33 | // never be used in an auotmatic process otherwise it is not realiable!
|
---|
34 | return "";
|
---|
35 |
|
---|
36 | case "Moving":
|
---|
37 | case "Tracking":
|
---|
38 | case "OnTrack":
|
---|
39 | console.out("Drive in '"+state.name+"'... sending STOP... waiting for 'Initialized'.");
|
---|
40 | dim.send("DRIVE_CONTROL/STOP");
|
---|
41 | return "Initialized";
|
---|
42 |
|
---|
43 | case "ERROR":
|
---|
44 | console.out("Drive in '"+state.name+"'... sending STOP... waiting for 'Initialized'");
|
---|
45 | dim.send("DRIVE_CONTROL/STOP");
|
---|
46 | return "Initialized"; // Process that again if necessary
|
---|
47 |
|
---|
48 | case "Initialized":
|
---|
49 | return "";
|
---|
50 | }
|
---|
51 |
|
---|
52 | throw new Error("DRIVE_CONTROL:"+state.name+"["+state.index+"] unknown or not handled.");
|
---|
53 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.