-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrollerOutline.txt
92 lines (90 loc) · 2.47 KB
/
controllerOutline.txt
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Setup pins
Setup sensors
main control loop
check all sensors
read temperatures
read pressure
read board inputs
verify nothing is urgently wrong (Temp/pressure above cutoff)
set sensor data (in memory)
read all inputs
verify nothing is urgently wrong (E-stop)
get current state
if changed & dirty
call previousState.leaveState
if changed & clean
call currentState.enterState
set power LEDs
if state is:
Startup -- not handling this as a separate state...
EnterStartup:
Display welcome
Verify sensors and pins
Flash all LEDs
Set state to input selected state
verify set all relays off
ExitStartup:
continue
Setup
EnterSetup:
set min/max pot values (maybe just hardcoded)
min temp 120, max temp 200
min time 10 max time 60
max pressure 90psi
verify set all relays off
ExitSetup:
Display profile ID
Confirm save?
Green - yes, red - no
hold dirty state until response
SaveSetup:
Grab pots values, save to db
use switches to set profile mode
InStartup:
Display Pots readings
Manual
EnterManual:
record run number & start time
ExitManual:
turn off all relays
update run metadata
InManual:
Set relays according to switches
Display Temps & pressure
Record temps & pressure
Automatic
EnterAutomatic:
Set auto-state to Initializing
ExitAutomatic:
Verify state != running
if running, hold in dirty state
InAutomatic:
Initializing
prompt for select run profile
wait for green button press
Starting
pressurize bladders
record run start time, profile (persist in log format so if profile changes in the future we still have record of exact run parameters)
if red button pressed, log and skip to finished/stopped
if necessary, prompt to set overrides to auto
await green button press (allow for pressure override)
Running
take profile parameters and run to spec
set relay indicator leds
cold, good, hot
log temperature/pressure
check for manual override (off/auto/on)
if red button pressed, log and skip to finished/stopped
Finished/Stopped
turn off heat relays
vent air until pressure is down
green button press loops back to Initializing
Error
EnterError:
turn on error light
turn off all relays(unless pressure issue, then open relief valve)
Display message
ExitError:
hold dirty until reset button press
InError:
blink error light