X-Git-Url: https://git.ralfj.de/saartuer.git/blobdiff_plain/01b0198699d9871bf642930ece770d0d1be917b9..27ea44f35684aeab9a5677bd64892d6de950fb4e:/tuerd?ds=inline diff --git a/tuerd b/tuerd index a283f26..1d49f65 100755 --- a/tuerd +++ b/tuerd @@ -1,5 +1,5 @@ #!/usr/bin/python3 -import time, socket, os, stat +import time, socket, os, stat, atexit from datetime import datetime import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) @@ -52,6 +52,9 @@ pinlist = [Pinoutput("open", 12, [(True, 0.3), (False, 5.0)]), # ******** main ********* +# at the end do a cleanup +atexit.register(GPIO.cleanup); + # convert list of pin objects to dictionary for command lookup pindict = {} for pin in pinlist: @@ -88,6 +91,3 @@ while True: # close connection cleanly conn.close() -# FIXME will this be executed after receiving a terminating signal? -GPIO.cleanup() -