diff --git a/garage/garage.py b/garage/garage.py index 106617f..5dfa31a 100644 --- a/garage/garage.py +++ b/garage/garage.py @@ -52,7 +52,6 @@ def logpush(message): logger.info(message) Thread(target=pushover,args=[message]).start() - # move robomower into safe zone def mower_safety(): try: @@ -108,16 +107,21 @@ def garage_button(channel): def gate_button(channel): time.sleep(0.01) if channel == 0 or GPIO.input(PIN_GATE_BUTTON) == GPIO.LOW: + toSafety = False if GPIO.input(PIN_SENSOR_GATE) == 0: - mower_safety() - else: - mower_auto() + toSafety = True + logger.info("trigger gate") GPIO.output(PIN_GATE, GPIO.HIGH) GPIO.output(PIN_LED, GPIO.HIGH) time.sleep(0.4) GPIO.output(PIN_GATE, GPIO.LOW) GPIO.output(PIN_LED, GPIO.LOW) + + if toSafety == True: + mower_safety() + else: + mower_auto() else: logger.info("flare (gate button)")