feat: add connect/disconnect status for real heater/stirrer hardware
Heater and Stirrer can be real serial hardware (hendi, Pololu1376), but there was no connection concept at all - the constructors opened the port and crashed the whole server if the device was missing, with no way to see connection status or firmware version and no way to reconnect without a restart. Adds an observable Connectable mixin (components/connectable.py) shared by AHeater/AStirrer; real devices defer opening the serial port to an explicit connect(), auto-connect on server startup, and surface Connected/FirmwareVersion/Simulated plus manual Connect/Disconnect over the web GUI. Heating/stirring and Sud Start are all gated on connection state, and a disconnect mid-brew force-stops the run via the same path as a manual Stop. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YaPLuRPpyjWcwhMvCvpHCL
This commit is contained in:
+7
-1
@@ -139,9 +139,15 @@ if __name__ == '__main__':
|
||||
forecast_estimator = SudForecastEstimator(
|
||||
DT, theta_amb, config['TempCtrl']['pid_type'], config['TempCtrl'],
|
||||
heater.get_powers(), sim_warp_factor, config.get('Pot', {}))
|
||||
sud_task = SudTask(sud, tc, stirrer, pot, DT, DT_TASK, dispatcher.msgio_get("Sud"), forecast_estimator)
|
||||
sud_task = SudTask(sud, tc, stirrer, heater, pot, DT, DT_TASK, dispatcher.msgio_get("Sud"), forecast_estimator)
|
||||
taskmgr.add(sud_task)
|
||||
|
||||
# A run in progress gets force-stopped (mirrors a manual Stop) if the
|
||||
# heater or stirrer it depends on disconnects mid-brew - see SudTask.
|
||||
# check_connections()'s own comment for why.
|
||||
heater_task.set_on_connected_changed(lambda connected: sud_task.check_connections())
|
||||
stirrer_task.set_on_connected_changed(lambda connected: sud_task.check_connections())
|
||||
|
||||
# How often the server/sud logs checkpoint themselves to disk (in
|
||||
# addition to always writing on their own end trigger) - so a hard
|
||||
# crash/power loss only loses up to this much data. Config-only (no CLI
|
||||
|
||||
Reference in New Issue
Block a user