123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- class CalibrationStateMashine():
- def __init__(self,log_handler):
- 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 = 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
|