flamesample: improve comments to parmod.SwitchDriv

This commit is contained in:
l_samenv 2024-02-23 10:00:48 +01:00
parent 5b0da3ba98
commit 2b42e3fa0a

View File

@ -149,7 +149,7 @@ class SwitchDriv(HasConvergence, Drivable):
# disable_other = Parameter('whether to disable unused channel', BoolType(), readonly=False) # disable_other = Parameter('whether to disable unused channel', BoolType(), readonly=False)
selected = Parameter('selected module', EnumType(low=LOW, high=HIGH), readonly=False, default=0) selected = Parameter('selected module', EnumType(low=LOW, high=HIGH), readonly=False, default=0)
autoswitch = Parameter('switch sensor automatically', BoolType(), readonly=False, default=True) autoswitch = Parameter('switch sensor automatically', BoolType(), readonly=False, default=True)
_switch_target = None # if not None, switch to selection mhen mid range is reached _switch_target = None # if not None, switch to selection when mid range is reached
# TODO: copy units from attached module # TODO: copy units from attached module
# TODO: callbacks for updates # TODO: callbacks for updates
@ -167,7 +167,7 @@ class SwitchDriv(HasConvergence, Drivable):
return return
else: else:
high = get_value(self.high, mid) # return mid when high is invalid high = get_value(self.high, mid) # return mid when high is invalid
if high < mid: if high < mid: # change to self.max_low
self.value = self.high.value self.value = self.high.value
self._switch_target = None self._switch_target = None
self.write_target(self.target) self.write_target(self.target)
@ -221,6 +221,7 @@ class SwitchDriv(HasConvergence, Drivable):
this, other = other, this this, other = other, this
selected = HIGH selected = HIGH
elif target < self.min_high * 0.75 + self.max_low * 0.25: elif target < self.min_high * 0.75 + self.max_low * 0.25:
# reinstall this with higher threshold (e.g. 4 K)?
#if self.value > self.max_low: #if self.value > self.max_low:
# target1 = max(self.min_high, target) # target1 = max(self.min_high, target)
# self._switch_target = LOW # self._switch_target = LOW