X-Git-Url: https://git.ralfj.de/saartuer.git/blobdiff_plain/6e7d90d419547705cb125adc7fe3626d9dc0fd49..afd14c9b67b6fb41219abf0dcd5e7fda37a1b8a9:/ringd?ds=sidebyside diff --git a/ringd b/ringd index 812043a..3835d9c 100755 --- a/ringd +++ b/ringd @@ -1,5 +1,5 @@ #!/usr/bin/python3 -import time, socket +import time, socket, atexit import RPi.GPIO as GPIO tuerSock = "/run/tuer.sock" @@ -8,6 +8,7 @@ ringPin = 18 GPIO.setmode(GPIO.BOARD) GPIO.setup(ringPin, GPIO.IN) +atexit.register(GPIO.cleanup); lastEvent = 0 @@ -33,4 +34,4 @@ while True: if data != b'1': print("Received unexpected answer %s" % str(data)) -GPIO.cleanup() +