From fdea19a45bf46a7b6bb0e7e7870e6f31dda0c69f Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 11 Oct 2016 15:37:34 +0100 Subject: [PATCH] leave Pi GPIO pins in a sensible state on error --- nodes/core/hardware/nrgpio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nodes/core/hardware/nrgpio.py b/nodes/core/hardware/nrgpio.py index 34a3feffd..4a3218df7 100755 --- a/nodes/core/hardware/nrgpio.py +++ b/nodes/core/hardware/nrgpio.py @@ -89,7 +89,10 @@ if len(sys.argv) > 2: GPIO.cleanup(pin) sys.exit(0) except: - data = 0 + if len(sys.argv) == 4: + data = int(sys.argv[3]) + else: + data = 0 if data != 0: data = 1 GPIO.output(pin,data)