else:
return 'safe'
+# LED (and alarms) management function we'll arrange to run periodically
+def manageLEDs():
+ # cherrypy.log("manageLEDs")
+ armed = sense_armed()
+
+ # set siren (alarm_a) output
+ if armed == "armed":
+ set_line_values("/dev/gpiochip0", {27: Value.ACTIVE})
+ else:
+ set_line_values("/dev/gpiochip0", {27: Value.INACTIVE})
+
+ # set strobe (alarm_b) output
+ if armed == "armed":
+ set_line_values("/dev/gpiochip0", {17: Value.ACTIVE})
+ else:
+ set_line_values("/dev/gpiochip0", {17: Value.INACTIVE})
+
+ # set continuity LED based on pyro voltage
+ if pyro == "good":
+ set_line_values("/dev/gpiochip0", {20: Value.ACTIVE})
+ else:
+ set_line_values("/dev/gpiochip0", {20: Value.INACTIVE})
+
+ # set armed LED based on safe/arm switch setting
+ if armed == "safe":
+ set_line_values("/dev/gpiochip0", {21: Value.INACTIVE})
+ else:
+ set_line_values("/dev/gpiochip0", {21: Value.ACTIVE})
+
path = os.path.abspath(os.path.dirname(__file__))
config = {
'global' : {
chan.attrs['scale'].value = SCALE
chan.attrs['offset'].value = OFFSET
+ # subscribe our LED management function to the main loop
+ cherrypy.engine.subscribe('main', manageLEDs)
+
# launch web user interface
cherrypy.quickstart(App(), '/', config)