fix: re-enable closed-loop on Sud start regardless of client
HeaterTask.shutdown() switched the heater to open-loop when a brew
ended, but nothing switched it back when a new Sud was started. The
browser happened to send {ClosedLoop: true} as part of its UI setup,
so its connect-and-start path worked; PyQt (and any other client that
doesn't send that message) left the heater in open-loop and the TC
never drove it.
Add SudTask._on_start / set_on_start() hook, HeaterTask.start_closed_loop()
(mirror of shutdown()), and wire them in brewpi.py so the server
switches to closed-loop and broadcasts the new state to all clients the
moment any client starts a brew.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -143,6 +143,9 @@ if __name__ == '__main__':
|
||||
tc.set_on_changed("y", heater_task.actor)
|
||||
# HeaterTask owns TC enable: enabled in closed-loop mode, disabled in open-loop.
|
||||
heater_task.set_on_closed_loop_changed(tc.set_enabled)
|
||||
# Brew start: switch heater to closed-loop so the TC drives it regardless
|
||||
# of which client (browser, PyQt GUI, …) started the brew.
|
||||
sud_task.set_on_start(heater_task.start_closed_loop)
|
||||
# Brew end (DONE/IDLE): shut heater off and broadcast open-loop/power-0 to clients.
|
||||
sud_task.set_on_end(heater_task.shutdown)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user