teardown cleaned up

This commit is contained in:
Balthasar Reuter
2015-06-04 16:16:15 +02:00
parent db922938cc
commit eb2344d066

View File

@@ -385,7 +385,7 @@ def handle_gpio_event(channel):
display.show_message("\n\nShutting down!") display.show_message("\n\nShutting down!")
display.apply() display.apply()
sleep(1) sleep(1)
teardown(0, True) teardown()
def handle_exception(msg): def handle_exception(msg):
"""Displays an error message and returns""" """Displays an error message and returns"""
@@ -415,13 +415,11 @@ def handle_gpio(channel):
"""Interrupt handler for GPIO events""" """Interrupt handler for GPIO events"""
display.trigger_event(gpio_pygame_event, channel) display.trigger_event(gpio_pygame_event, channel)
def teardown(exit_code=0, shutdown=False): def teardown(exit_code=0):
display.teardown() display.teardown()
if gpio_enabled: if gpio_enabled:
GPIO.cleanup() GPIO.cleanup()
exit(exit_code) exit(exit_code)
if shutdown:
os.system("shutdown -h now")
def main(): def main():
setup_gpio() setup_gpio()