Commit e19c7781ae76dc9d91d2f17492bb53a7f16bdc70
1 parent
b8ce08195f
Exists in
main
switch to warn / alarm states for yellow and red lights
Showing 1 changed file with 18 additions and 11 deletions Side-by-side Diff
ssa/alarm/alarmist.py
View file @
e19c778
... | ... | @@ -177,41 +177,48 @@ |
177 | 177 | # |
178 | 178 | # run checks to throw alarms |
179 | 179 | # |
180 | - buzzer = False | |
181 | - # is paddle running? (solid white, no buzzer) | |
180 | + warning = False | |
181 | + alarm = False | |
182 | + # is paddle running? (solid white, no problems) | |
182 | 183 | if paddle_on: |
183 | 184 | self.lights.on(lightstack.Channel.White) |
184 | 185 | else: |
185 | 186 | self.lights.off(lightstack.Channel.White) |
186 | - # is paddle moving? (solid green, no buzzer) | |
187 | + # is paddle moving? (solid green, no problems) | |
187 | 188 | if paddle_moving: |
188 | 189 | self.lights.on(lightstack.Channel.Green) |
189 | 190 | else: |
190 | 191 | self.lights.off(lightstack.Channel.Green) |
191 | - # is water running? (solid blue, no buzzer) | |
192 | + # is water running? (solid blue, no problems) | |
192 | 193 | if coolant_on: |
193 | 194 | self.lights.on(lightstack.Channel.Blue) |
194 | 195 | else: |
195 | 196 | self.lights.off(lightstack.Channel.Blue) |
196 | - # is paddle moving without water? (flash blue w/ buzzer) | |
197 | + # is paddle moving without water? (alarm state and flash blue) | |
197 | 198 | if paddle_moving and not coolant_on: |
198 | 199 | self.lights.start_blink(0.5, lightstack.Channel.Blue) |
199 | - buzzer = True | |
200 | + alarm = True | |
200 | 201 | else: |
201 | 202 | self.lights.stop_blink(lightstack.Channel.Blue) |
202 | - # is the hottest bearing above ambient? (flash red, no buzzer) | |
203 | + # is the hottest bearing above ambient? (warning) | |
203 | 204 | if bearing_temperature_warning: |
204 | - self.lights.start_blink(0.5, lightstack.Channel.Red) | |
205 | - else: | |
206 | - self.lights.stop_blink(lightstack.Channel.Red) | |
205 | + warning = True | |
207 | 206 | # TODO - piston temps > 100F? (flash yellow w/ buzzer) |
208 | 207 | |
208 | + # did any warnings get thrown? (turn on yellow flashing) | |
209 | + if warning: | |
210 | + self.lights.start_blink(0.5, lightstack.Channel.Yellow) | |
211 | + else: | |
212 | + self.lights.stop_blink(lightstack.Channel.Yellow) | |
213 | + | |
209 | 214 | # |
210 | 215 | # did any alarm want to turn on the buzzer? |
211 | 216 | # |
212 | - if buzzer: | |
217 | + if alarm: | |
218 | + self.lights.start_blink(0.3, lightstack.Channel.Red) | |
213 | 219 | self.lights.start_blink(0.3, lightstack.Channel.Buzzer) |
214 | 220 | else: |
221 | + self.lights.stop_blink(lightstack.Channel.Red) | |
215 | 222 | self.lights.stop_blink(lightstack.Channel.Buzzer) |
216 | 223 | |
217 | 224 | # clear event flag |