12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import logHandler
- class CalibrationStateMashine():
- def __init__(self):
- self.state = 0
- self.progress = 0
- self.NOT_CALIBRATED = 0
- self.WAITING_POS_1 = 1
- self.ACCUMULATING_1 = 2
- self.WAITING_POS_2 = 3
- self.ACCUMULATING_2 = 4
- self.CALIBRATION_DONE = 5
- self.log_handler = logHandler.get_log_handler()
-
- def state_clearname(self):
- if self.state == self.NOT_CALIBRATED:
- return "not calibrated"
- elif self.state == self.WAITING_POS_1:
- return "Waiting for Position one"
- elif self.state == self.ACCUMULATING_1:
- return "gathering values on position one"
- elif self.state == self.WAITING_POS_2:
- return "Waiting for position two"
- elif self.state == self.ACCUMULATING_2:
- return "gathering values on position two"
- elif self.state == self.CALIBRATION_DONE:
- return "calibration done"
-
- def next_state(self):
- if self.state < self.CALIBRATION_DONE:
- self.state += 1
- self.log_handler.log_and_print("calibration state: ",self.state_clearname())
- def next_state_gui(self):
- if self.state == self.WAITING_POS_1 or self.state == self.WAITING_POS_2:
- self.next_state()
- def get_state(self):
- return self.state
- def reset_state(self):
- self.state = 0
- self.progress = 0
|