projects
/
saartuer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup atexit
[saartuer.git]
/
tuerd
diff --git
a/tuerd
b/tuerd
index a283f26d9221c47feae5b31758b7dc0181cb84ca..1d49f652b5e7b892a7ec0789c96a308f39d9cf6a 100755
(executable)
--- a/
tuerd
+++ b/
tuerd
@@
-1,5
+1,5
@@
#!/usr/bin/python3
#!/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)
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 *********
# ******** 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:
# 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()
# close connection cleanly
conn.close()
-# FIXME will this be executed after receiving a terminating signal?
-GPIO.cleanup()
-