From e19c7781ae76dc9d91d2f17492bb53a7f16bdc70 Mon Sep 17 00:00:00 2001 From: Greg Sandstrom Date: Wed, 5 Jul 2023 10:45:00 -0700 Subject: [PATCH] switch to warn / alarm states for yellow and red lights --- ssa/alarm/alarmist.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/ssa/alarm/alarmist.py b/ssa/alarm/alarmist.py index e2058b7..10459ea 100644 --- a/ssa/alarm/alarmist.py +++ b/ssa/alarm/alarmist.py @@ -177,41 +177,48 @@ class Alarmist: # # run checks to throw alarms # - buzzer = False - # is paddle running? (solid white, no buzzer) + warning = False + alarm = False + # is paddle running? (solid white, no problems) if paddle_on: self.lights.on(lightstack.Channel.White) else: self.lights.off(lightstack.Channel.White) - # is paddle moving? (solid green, no buzzer) + # is paddle moving? (solid green, no problems) if paddle_moving: self.lights.on(lightstack.Channel.Green) else: self.lights.off(lightstack.Channel.Green) - # is water running? (solid blue, no buzzer) + # is water running? (solid blue, no problems) if coolant_on: self.lights.on(lightstack.Channel.Blue) else: self.lights.off(lightstack.Channel.Blue) - # is paddle moving without water? (flash blue w/ buzzer) + # is paddle moving without water? (alarm state and flash blue) if paddle_moving and not coolant_on: self.lights.start_blink(0.5, lightstack.Channel.Blue) - buzzer = True + alarm = True else: self.lights.stop_blink(lightstack.Channel.Blue) - # is the hottest bearing above ambient? (flash red, no buzzer) + # is the hottest bearing above ambient? (warning) if bearing_temperature_warning: - self.lights.start_blink(0.5, lightstack.Channel.Red) - else: - self.lights.stop_blink(lightstack.Channel.Red) + warning = True # TODO - piston temps > 100F? (flash yellow w/ buzzer) + # did any warnings get thrown? (turn on yellow flashing) + if warning: + self.lights.start_blink(0.5, lightstack.Channel.Yellow) + else: + self.lights.stop_blink(lightstack.Channel.Yellow) + # # did any alarm want to turn on the buzzer? # - if buzzer: + if alarm: + self.lights.start_blink(0.3, lightstack.Channel.Red) self.lights.start_blink(0.3, lightstack.Channel.Buzzer) else: + self.lights.stop_blink(lightstack.Channel.Red) self.lights.stop_blink(lightstack.Channel.Buzzer) # clear event flag -- 1.9.1