Commit df29b164 authored by Hugo Hörnquist's avatar Hugo Hörnquist

Add flask_raise mode.

parent 5dfa3efb
......@@ -107,9 +107,14 @@ def wait_btn():
return g.wait_for_edge(btn_pin, g.RISING, bouncetime=500)
#g.wait_for_edge(btn_pin, g.RISING)
class Modes:
button = 0
flask_raise = 1
def main():
global state, pins
last_time = 0
mode = Modes.button
while True:
if state == States.no_hafv:
print
......@@ -120,26 +125,36 @@ def main():
elif state == States.hafv_ready:
print "Hafv redo"
lcd_info("Starta med knapp", last_time)
wait_btn()
if mode == Modes.button:
lcd_info("Starta med knapp", last_time)
wait_btn()
elif mode == Modes.flask_raise:
lcd_info("Starta med lyft", last_time)
wait_for_bottle_remove()
state = States.hafv_active
start_time = time_ms()
elif state == States.hafv_active:
print "currently Hafving"
lcd_info("Klockar", last_time)
if not bottle_check(pins):
if mode == Mode.button and not bottle_check(pins):
print "Early start"
lcd_info("Tjuvstart!", last_time)
wait_btn()
state = States.no_hafv
continue
print "Raise the bottle"
wait_for_bottle_remove()
print "BOTTLE RAISED"
# TODO we actually don't need this, but it was
# here before so it stays until I refactor this.
if mode == Modes.button:
wait_for_bottle_remove()
print "BOTTLE RAISED"
print "Place back bottle after hafv"
wait_for_bottle_place()
print "BOTTLE PLACED"
# Wait for bottle placed is in a loop because if the time
# is under 1 secound then we want to wait again. This is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment