trigger gate first, then message to mower (takes seconds)

This commit is contained in:
2021-05-28 16:52:55 +02:00
parent 00a49441cf
commit ca876dbe1f
+8 -4
View File
@@ -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)")