diff --git a/scripts/__pycache__/capture_csv.cpython-314.pyc b/scripts/__pycache__/capture_csv.cpython-314.pyc index 341e123..5150bf8 100644 Binary files a/scripts/__pycache__/capture_csv.cpython-314.pyc and b/scripts/__pycache__/capture_csv.cpython-314.pyc differ diff --git a/scripts/__pycache__/dryer_tui.cpython-314.pyc b/scripts/__pycache__/dryer_tui.cpython-314.pyc index a2e4d58..b5d3056 100644 Binary files a/scripts/__pycache__/dryer_tui.cpython-314.pyc and b/scripts/__pycache__/dryer_tui.cpython-314.pyc differ diff --git a/scripts/dryer_tui.py b/scripts/dryer_tui.py index 1f0300b..c00b702 100644 --- a/scripts/dryer_tui.py +++ b/scripts/dryer_tui.py @@ -40,11 +40,13 @@ STATUS_RE = re.compile( r"spread=(?P[\d.]+)C\s+" r"heatlim=(?P\d+)%\s+" r"heater=(?P[\d.]+)%\s+" - r"fan=(?P\d+)(?P\([^)]*\))?\s+" + r"htop=(?P\S+)\s+" + r"hblk=(?P\S+)\s+" + r"ssr=(?Pon|off)\s+" + r"fan=(?P\S+)\s+" r"cutoff=(?P\S+)\s+" r"failsafe=(?P\S+)\s+" - r"mode=(?P\S+)\s+" - r"sensors=\[(?P.*)\]" + r"mode=(?P.+?)\s+sensors=\[(?P.*)\]" ) SENSOR_RE = re.compile(r"ch(\d+):([\d.]+)C/(\d+)%|ch(\d+):ERR") @@ -60,6 +62,9 @@ class DryerState: spread: str = "—" heatlim: str = "—" heater: str = "—" + htop: str = "—" + hblk: str = "—" + ssr: str = "—" fan: str = "—" fan_note: str = "" cutoff_active: str = "no" @@ -91,7 +96,6 @@ def parse_status(line: str) -> dict | None: else: sensors.append((m.group(1), m.group(2), m.group(3))) data["sensor_list"] = sensors - data["fan_note"] = data.get("fan_note") or "" return data @@ -116,8 +120,14 @@ def apply_status(state: DryerState, data: dict) -> None: state.spread = data["spread"] state.heatlim = data["heatlim"] state.heater = data["heater"] - state.fan = data["fan"] - state.fan_note = data["fan_note"] + state.htop = data["htop"].removesuffix("C") if data["htop"].endswith("C") else data["htop"] + state.hblk = data["hblk"] + state.ssr = data["ssr"] + fan_raw = data["fan"] + state.fan = fan_raw + state.fan_note = "" + if fan_raw.endswith("(off)") or fan_raw.endswith("(cooldown)") or " TEST" in fan_raw: + state.fan_note = fan_raw[fan_raw.find("(") :] if "(" in fan_raw else "" state.cutoff_active = data["cutoff_active"] state.failsafe = data["failsafe"] state.mode = data["mode"] @@ -206,6 +216,10 @@ class SerialWorker: apply_status(self.state, parsed) continue + if line.startswith("target="): + self._note("WARN: could not parse status line") + continue + if line.startswith("OK") or line.startswith("ERR") or line.startswith("WARN"): self._note(line) @@ -324,8 +338,16 @@ def _draw_dashboard(stdscr, state: DryerState) -> None: _safe_addstr(stdscr, row, 2, f"Avg: {state.avg} °C Min: {state.min_temp} °C Max: {state.max_temp} °C Spread: {state.spread} °C") row += 1 - fan_text = f"{state.fan} %{state.fan_note}" - _safe_addstr(stdscr, row, 2, f"Heater: {state.heater} % Fan: {fan_text} Limit: {state.heatlim} %") + fan_text = state.fan if state.fan_note == "" else state.fan + _safe_addstr( + stdscr, + row, + 2, + f"Heater: {state.heater} % SSR: {state.ssr} Fan: {fan_text} Limit: {state.heatlim} %", + ) + + row += 1 + _safe_addstr(stdscr, row, 2, f"Heat stop: {state.htop} °C Block: {state.hblk}") row += 2 _draw_box(stdscr, row, 1, 5, width - 2, "Sensors") @@ -403,6 +425,9 @@ def _curses_main(stdscr, ser, log_dir: Path, auto_log_on: bool) -> int: spread=state.spread, heatlim=state.heatlim, heater=state.heater, + htop=state.htop, + hblk=state.hblk, + ssr=state.ssr, fan=state.fan, fan_note=state.fan_note, cutoff_active=state.cutoff_active,