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
+8 -6
View File
@@ -8,12 +8,14 @@ class States(Enum):
HOLD = 2
THRESH_HOLD_IDLE = 0.1
THRESH_HOLD_HEAT = 1.0
THRESH_IDLE_HEAT = 1.0
THRESH_IDLE_HOLD = 0.1
THRESH_HEAT_HOLD = 1.0
THRESH_HEAT_IDLE = 1.0
DEFAULT_THRESHOLDS = {
"HoldIdle": 0.1,
"HoldHeat": 1.0,
"IdleHeat": 1.0,
"IdleHold": 0.1,
"HeatHold": 1.0,
"HeatIdle": 1.0
}
class Test: