improvements in magfiels/ips_mercury

- read voltage
- fix a bug with ._init name conflict
This commit is contained in:
2022-08-12 15:10:23 +02:00
parent 3496e391f6
commit 8e3cdc80e4
4 changed files with 25 additions and 7 deletions

View File

@ -89,6 +89,10 @@ class HasConvergence:
"""to be called from write_target"""
self.convergence_state.start(self.state_approach)
def interrupt_state(self):
"""to be called from stop"""
self.convergence_state.start(self.state_instable)
def state_approach(self, state):
"""approaching, checking progress (busy)"""
state.spent_inside = 0
@ -157,3 +161,10 @@ class HasConvergence:
else:
state.spent_inside = max(0, state.spent_inside - state.delta())
return Retry()
def state_interrupt(self, state):
self.status = IDLE, 'stopped' # stop called
return self.state_instable
def stop(self):
self.convergence_state.start(self.state_interrupt)