thrust = 0
pyro = 0
battery = 0
+lastsense = "safe"
# global to keep track of whether user wants system armed
armreq = "disarm"
+# global to keep track of whether we're actively running a test
+status = "idle"
+
ctx = iio.LocalContext()
ctrl = ctx.find_device('ads8688')
# configuration for each channel on ADS8688
signal.signal(signal.SIGINT, handler)
def sense_armed():
+ try:
with gpiod.request_lines(
"/dev/gpiochip0",
consumer="get-line-value",
value = request.get_value(12)
if value == Value.ACTIVE:
if armreq == "arm":
- return 'armed'
+ lastsense = 'armed'
else:
- return 'remote'
+ lastsense = 'remote'
else:
- return 'safe'
+ lastsense = 'safe'
+ finally:
+ return lastsense
# LED (and alarms) management function we'll arrange to run periodically
def manageLEDs():
# copy metadata into test directory
metadata_path = DATAPATH + "metadata.json"
shutil.copy(metadata_path, test_path)
+ status = "testing"
+ cherrypy.log("status " + status)
return "Test " + test_path + " started"
else:
return "Method not allowed", 405