diff --git a/tasks/sud.py b/tasks/sud.py index 1c9b22b..344ac94 100644 --- a/tasks/sud.py +++ b/tasks/sud.py @@ -435,6 +435,23 @@ class SudTask(ATask): self.sud.start() if fresh_start: asyncio.create_task(self.send_forecast(self.sud.save())) + else: + # Resume from PAUSED: re-apply current step's schedule + # parameters so any manual TC/stirrer changes made while + # paused are overwritten by the schedule on play. + index = self.sud.index + if index is not None and 0 <= index < len(self.sud.schedule): + step = self.sud.schedule[index] + ramp = step.get('ramp') + hold = step.get('hold') + ramping = self.sud.state == SudState.RAMPING + if step.get('temperature') is not None: + self.tc.set_theta_soll(step['temperature']) + if ramping and ramp: + self.tc.set_heatrate_soll(ramp['rate']) + phase = ramp if ramping else hold + if phase is not None: + self.apply_stirrer(phase) elif 'Confirm' in pair[0]: # Sud.confirm() synchronously fires on_step_changed() for # the now-current step, which schedules the forecast