Make FSM hysteresis thresholds configurable

THRESH_HOLD_IDLE/HOLD_HEAT/IDLE_HEAT/IDLE_HOLD/HEAT_HOLD/HEAT_IDLE in
tc_constants.py were hardcoded module-level constants shared by every
controller instance, so tuning the IDLE/HOLD/HEAT hysteresis required
a code change.

Replace them with DEFAULT_THRESHOLDS plus an optional
TempCtrl.Thresholds config section, merged at construction time in
TempControllerBase.__init__ so configs that omit the section keep
behaving exactly as before. Documented the new section in
config.json.templ; left config.json.sim without it to exercise the
default-fallback path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 22:09:39 +02:00
co-authored by Claude Sonnet 4.6
parent b2a5652290
commit 4256622e9d
4 changed files with 29 additions and 20 deletions
+5 -6
View File
@@ -5,12 +5,11 @@ Findings from a design review, not yet acted on. See git history on
correction enabled, the two TempController classes deduplicated into
`temp_controller_base.py`).
- [ ] **FSM thresholds aren't configurable.** `tc_constants.py`'s
`THRESH_HOLD_IDLE`, `THRESH_HOLD_HEAT`, `THRESH_IDLE_HEAT`,
`THRESH_IDLE_HOLD`, `THRESH_HEAT_HOLD`, `THRESH_HEAT_IDLE` are
hardcoded module-level constants shared by every controller
instance. Move them into `config.json`'s `TempCtrl` section like the
PID gains, so mash schedules can tune hysteresis without code edits.
- [x] **FSM thresholds aren't configurable.** Moved into an optional
`TempCtrl.Thresholds` config section (`HoldIdle`, `HoldHeat`,
`IdleHeat`, `IdleHold`, `HeatHold`, `HeatIdle`), merged over
`DEFAULT_THRESHOLDS` in `tc_constants.py` so existing configs without
the section keep working unchanged.
- [ ] **`Pid.scale()` is a gain-scheduling hack, not anti-windup.**
`pid.py`'s `scale(k)` multiplies every gain by `1/heatrate_soll_set`