X-Git-Url: https://git.ralfj.de/saartuer.git/blobdiff_plain/6e7d90d419547705cb125adc7fe3626d9dc0fd49..27ea44f35684aeab9a5677bd64892d6de950fb4e:/ringd?ds=inline 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() +