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(): ...@@ -107,9 +107,14 @@ def wait_btn():
return g.wait_for_edge(btn_pin, g.RISING, bouncetime=500) return g.wait_for_edge(btn_pin, g.RISING, bouncetime=500)
#g.wait_for_edge(btn_pin, g.RISING) #g.wait_for_edge(btn_pin, g.RISING)
class Modes:
button = 0
flask_raise = 1
def main(): def main():
global state, pins global state, pins
last_time = 0 last_time = 0
mode = Modes.button
while True: while True:
if state == States.no_hafv: if state == States.no_hafv:
print print
...@@ -120,26 +125,36 @@ def main(): ...@@ -120,26 +125,36 @@ def main():
elif state == States.hafv_ready: elif state == States.hafv_ready:
print "Hafv redo" print "Hafv redo"
lcd_info("Starta med knapp", last_time) if mode == Modes.button:
wait_btn() lcd_info("Starta med knapp", last_time)
elif mode == Modes.flask_raise:
lcd_info("Starta med lyft", last_time)
state = States.hafv_active state = States.hafv_active
start_time = time_ms() start_time = time_ms()
elif state == States.hafv_active: elif state == States.hafv_active:
print "currently Hafving" print "currently Hafving"
lcd_info("Klockar", last_time) lcd_info("Klockar", last_time)
if not bottle_check(pins):
if mode == Mode.button and not bottle_check(pins):
print "Early start" print "Early start"
lcd_info("Tjuvstart!", last_time) lcd_info("Tjuvstart!", last_time)
wait_btn() wait_btn()
state = States.no_hafv state = States.no_hafv
continue continue
print "Raise the bottle" print "Raise the bottle"
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:
print "Place back bottle after hafv" print "Place back bottle after hafv"
# Wait for bottle placed is in a loop because if the time # Wait for bottle placed is in a loop because if the time
# is under 1 secound then we want to wait again. This is # 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