trigger gate first, then message to mower (takes seconds)
This commit is contained in:
+8
-4
@@ -52,7 +52,6 @@ def logpush(message):
|
|||||||
logger.info(message)
|
logger.info(message)
|
||||||
Thread(target=pushover,args=[message]).start()
|
Thread(target=pushover,args=[message]).start()
|
||||||
|
|
||||||
|
|
||||||
# move robomower into safe zone
|
# move robomower into safe zone
|
||||||
def mower_safety():
|
def mower_safety():
|
||||||
try:
|
try:
|
||||||
@@ -108,16 +107,21 @@ def garage_button(channel):
|
|||||||
def gate_button(channel):
|
def gate_button(channel):
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
if channel == 0 or GPIO.input(PIN_GATE_BUTTON) == GPIO.LOW:
|
if channel == 0 or GPIO.input(PIN_GATE_BUTTON) == GPIO.LOW:
|
||||||
|
toSafety = False
|
||||||
if GPIO.input(PIN_SENSOR_GATE) == 0:
|
if GPIO.input(PIN_SENSOR_GATE) == 0:
|
||||||
mower_safety()
|
toSafety = True
|
||||||
else:
|
|
||||||
mower_auto()
|
|
||||||
logger.info("trigger gate")
|
logger.info("trigger gate")
|
||||||
GPIO.output(PIN_GATE, GPIO.HIGH)
|
GPIO.output(PIN_GATE, GPIO.HIGH)
|
||||||
GPIO.output(PIN_LED, GPIO.HIGH)
|
GPIO.output(PIN_LED, GPIO.HIGH)
|
||||||
time.sleep(0.4)
|
time.sleep(0.4)
|
||||||
GPIO.output(PIN_GATE, GPIO.LOW)
|
GPIO.output(PIN_GATE, GPIO.LOW)
|
||||||
GPIO.output(PIN_LED, GPIO.LOW)
|
GPIO.output(PIN_LED, GPIO.LOW)
|
||||||
|
|
||||||
|
if toSafety == True:
|
||||||
|
mower_safety()
|
||||||
|
else:
|
||||||
|
mower_auto()
|
||||||
else:
|
else:
|
||||||
logger.info("flare (gate button)")
|
logger.info("flare (gate button)")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user