Allow a Sud step to combine a ramp and a hold
A step can now carry both 'ramp' and 'hold': it ramps to the target temp, then holds there for the given duration, instead of needing two separate schedule entries. Sud.temp_reached() switches such a step from its ramp phase into its hold phase in place (re-firing the step-changed callback so SudTask/demo_sud re-apply the hold's stirrer settings); user_wait_for_continue still applies once the whole step - both phases - is done. Merges sud_0010.json's three ramp/hold pairs into combined steps.
This commit is contained in:
+12
-1
@@ -157,7 +157,18 @@ class Sud(AttributeChange):
|
||||
self._advance()
|
||||
|
||||
def temp_reached(self):
|
||||
if self.state == SudState.RAMPING:
|
||||
if self.state != SudState.RAMPING:
|
||||
return
|
||||
if 'hold' in self.step:
|
||||
# Same step, ramp phase done - move into its hold phase rather
|
||||
# than finishing the step. Re-assign self.step (AttributeChange
|
||||
# fires on every assignment, not just on change) to re-trigger
|
||||
# the step-changed callback so e.g. the hold's stirrer settings
|
||||
# get (re-)applied.
|
||||
self.hold_remaining = self.step['hold'].get('duration', 0) * 60.0
|
||||
self.state = SudState.HOLDING
|
||||
self.step = self.step
|
||||
else:
|
||||
self._finish_step()
|
||||
|
||||
def tick(self, dt):
|
||||
|
||||
Reference in New Issue
Block a user