S&B Volcano vaporizer remote control with Pi Pico W
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

state_wait_time.py 869B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env python
  2. import time
  3. from state_wait_temp import draw_graph
  4. class StateWaitTime:
  5. def __init__(self, lcd):
  6. self.lcd = lcd
  7. def enter(self, val = None):
  8. self.value = val
  9. device, workflow, index = self.value
  10. self.start = time.time()
  11. self.end = self.start + int(workflow["steps"][index][1])
  12. def exit(self):
  13. return (self.value[0], self.value[1], self.value[2])
  14. async def draw(self):
  15. device, workflow, index = self.value
  16. self.lcd.text("Running Workflow - Wait {}".format(workflow["steps"][index][1]), 0, 10, self.lcd.red)
  17. keys = self.lcd.buttons()
  18. if keys.once("y"):
  19. return 4
  20. now = time.time()
  21. draw_graph(self.lcd, 0.0, now - self.start, self.end - self.start)
  22. if now >= self.end:
  23. return 8
  24. return -1