| @@ -31,10 +31,10 @@ class Simple(resource.Resource): | |||||
| # GPIO | # GPIO | ||||
| pin_kugel = 2 | |||||
| pin_sun = 4 | |||||
| pin_pir = 0 | |||||
| pin_door = 11 | |||||
| pin_kugel = 2 # Input: dico ball + DMX on/off | |||||
| pin_sun = 4 # Input: light bulb on/off | |||||
| pin_pir = 0 # Output: PIR sensor | |||||
| pin_door = 11 # Output: door open/closed sensor | |||||
| # for system stuff | # for system stuff | ||||
| @@ -336,6 +336,7 @@ def closeService(sleepsecs=0): | |||||
| setMode('off') | setMode('off') | ||||
| sleep(sleepsecs) | sleep(sleepsecs) | ||||
| # function when user arrives | |||||
| def initService(): | def initService(): | ||||
| startMusic('0', True) # start intro music | startMusic('0', True) # start intro music | ||||
| setDiscoMode(True) | setDiscoMode(True) | ||||
| @@ -413,7 +414,7 @@ lastUsed = time.time() # helper for timeout | |||||
| inUse = False # is toilet in use? | inUse = False # is toilet in use? | ||||
| inUseBefore = False # helper to check statechanges | inUseBefore = False # helper to check statechanges | ||||
| mode = "off" # can be: disco, work, off | mode = "off" # can be: disco, work, off | ||||
| timeout = 2 * 60 - 10 # timeout since last user interaction | |||||
| timeout = 5 * 60 - 5 # timeout since last user interaction | |||||
| defaultvolume = 90 # Volume when user enters the toilet | defaultvolume = 90 # Volume when user enters the toilet | ||||
| volume = 90 # Global for actual volume | volume = 90 # Global for actual volume | ||||
| uservolume = 90 # Global for user volume (ignores mute state) | uservolume = 90 # Global for user volume (ignores mute state) | ||||
| @@ -433,6 +434,7 @@ while True: | |||||
| # 0 => door closed | # 0 => door closed | ||||
| # 1 => door open | # 1 => door open | ||||
| if doorstate == 1: | if doorstate == 1: | ||||
| # don't do a doorShutdown when user comes in | |||||
| if (time.time() > (starttime + 15) and inUse == True): | if (time.time() > (starttime + 15) and inUse == True): | ||||
| doorShutdown() | doorShutdown() | ||||