improvements in magfield

- use HasTargetLimits instead of HasLimits
- move ramp_tmo parameter to SompleMagfield
- add last_target method
- fix progress check in SimpleMagfield.ramp_to_target
- better mechanism for setting to persistent mode after restart
- fix switching mode
- fix on_error
- fix condition for shortcut start_field_change -> check_switch_off
- remove direct status updates
- move check for manual switch heater operations to ips_mercury
This commit is contained in:
l_samenv
2022-12-21 10:57:41 +01:00
parent 79b8cd7b2d
commit 766f15beee
2 changed files with 69 additions and 47 deletions

View File

@ -288,6 +288,24 @@ class Field(SimpleField, Magfield):
return Retry
return sm.after_wait
def wait_for_switch_on(self, sm):
self.read_switch_heater() # trigger switch_on/off_time
if self.switch_heater == self.switch_heater.OFF:
if sm.init: # avoid too many states chained
return Retry
self.log.warning('switch turned off manually?')
return self.start_switch_on
return super().wait_for_switch_on(sm)
def wait_for_switch_off(self, sm):
self.read_switch_heater()
if self.switch_heater == self.switch_heater.ON:
if sm.init: # avoid too many states chained
return Retry
self.log.warning('switch turned on manually?')
return self.start_switch_off
return super().wait_for_switch_off(sm)
def start_ramp_to_zero(self, sm):
try:
assert self.write_action(Action.hold) == Action.hold