fix handling of persistent_field parameter
'persistent_field' parameter should be updated as long as the switch is turning off Change-Id: I76b592077ceb0a2a20beb8e6390487c620764650
This commit is contained in:
parent
80d9a790ec
commit
cf42119f85
@ -114,7 +114,8 @@ class Magfield(HasLimits, Drivable):
|
|||||||
def write_target(self, target):
|
def write_target(self, target):
|
||||||
self.check_limits(target)
|
self.check_limits(target)
|
||||||
self.target = target
|
self.target = target
|
||||||
if not self._state.is_active: # as long as the state machine is still running, it takes care of changing targets
|
if not self._state.is_active:
|
||||||
|
# as long as the state machine is still running, it takes care of changing targets
|
||||||
self._state.start(self.start_field_change)
|
self._state.start(self.start_field_change)
|
||||||
self.doPoll()
|
self.doPoll()
|
||||||
return Done
|
return Done
|
||||||
@ -230,8 +231,6 @@ class Magfield(HasLimits, Drivable):
|
|||||||
if state.init:
|
if state.init:
|
||||||
self.status = Status.STABILIZING, 'stabilizing field'
|
self.status = Status.STABILIZING, 'stabilizing field'
|
||||||
return Retry()
|
return Retry()
|
||||||
if abs(self.value - state.set_point) < self.tolerance:
|
|
||||||
self.persistent_field = state.set_point
|
|
||||||
return self.check_switch_off
|
return self.check_switch_off
|
||||||
|
|
||||||
def check_switch_off(self, state):
|
def check_switch_off(self, state):
|
||||||
@ -258,6 +257,7 @@ class Magfield(HasLimits, Drivable):
|
|||||||
return self.start_switch_on
|
return self.start_switch_on
|
||||||
if self.mode == Mode.DRIVEN:
|
if self.mode == Mode.DRIVEN:
|
||||||
return self.start_switch_on
|
return self.start_switch_on
|
||||||
|
self.persistent_field = self.value
|
||||||
if state.now - self.switch_time < self.wait_switch_off:
|
if state.now - self.switch_time < self.wait_switch_off:
|
||||||
return Retry()
|
return Retry()
|
||||||
return self.start_ramp_to_zero
|
return self.start_ramp_to_zero
|
||||||
|
Loading…
x
Reference in New Issue
Block a user