-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyTrolley.h
More file actions
49 lines (43 loc) · 1.53 KB
/
Copy pathmyTrolley.h
File metadata and controls
49 lines (43 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// TODO we may need to use SETFREQ during bootup
// TODO see ANOUT & PLAYSOUND for how to add mp3s with a DFPlayer
#define TROLLEY_SPEED 50 // TODO actual value needed
#define TROLLEY_SHRT_MS 2500
#define TROLLEY_MED_MS 10000
#define TROLLEY_LNG_MS 25000
ALIAS(TROLLEY_STASH)
ALIAS(TROLLEY_START)
ALIAS(TROLLEY_STOP)
// We start at or driving westbound to the west IR sensor. This is the only
// sequence that will be visible to throttles
AUTOMATION(TROLLEY_START,"Start Trolley")
ROUTE_ACTIVE(TROLLEY_START)
ROUTE_INACTIVE(TROLLEY_STOP)
STASH(TROLLEY_STASH)
IF(SENS_IR_STREET_WEST) FOLLOW(TROLLEY_LOOP) ENDIF
FWD(TROLLEY_SPEED)
AT(SENS_IR_STREET_WEST) STOP FOLLOW(TROLLEY_LOOP)
DONE
AUTOMATION(TROLLEY_STOP,"Stop Trolley")
PICKUP_STASH(TROLLEY_STASH)
STOP
ROUTE_INACTIVE(TROLLEY_START)
ROUTE_HIDDEN(TROLLEY_STOP)
DONE
// Assumes starting position at SENS_IR_STREET_WEST then travels eastbound, then
// westbound, ad naseum. Hidden to throttles, must use the start automation in
// order ascertain the location of the trolley safely.
ALIAS(TROLLEY_LOOP)
SEQUENCE(TROLLEY_LOOP)
REV(TROLLEY_SPEED)
AT(SENS_IR_STREET_MIDD) STOP DELAYRANDOM(TROLLEY_SHRT_MS, TROLLEY_MED_MS)
REV(TROLLEY_SPEED)
AT(SENS_IR_STREET_EAST) STOP DELAYRANDOM(TROLLEY_MED_MS, TROLLEY_LNG_MS)
FWD(TROLLEY_SPEED)
AT(SENS_IR_STREET_MIDD) STOP DELAYRANDOM(TROLLEY_SHRT_MS, TROLLEY_MED_MS)
FWD(TROLLEY_SPEED)
AT(SENS_IR_STREET_WEST) STOP DELAYRANDOM(TROLLEY_MED_MS, TROLLEY_LNG_MS)
FOLLOW(TROLLEY_LOOP)
DONE
AUTOSTART
ROUTE_HIDDEN(TROLLEY_STOP)
DONE