Skip to content

fix(schrack_ev): read the CION again after a silent start (1.1.1) - #321

Open
frahlg wants to merge 1 commit into
mainfrom
fix/schrack_ev-wake
Open

frahlg wants to merge 1 commit into
mainfrom
fix/schrack_ev-wake

Conversation

@frahlg

@frahlg frahlg commented Dec 5, 2026

Copy link
Copy Markdown
Member

Problem

schrack_ev 1.1.0 read every register through probe_read, which leaves a register alone until restart after three misses. It read the model block (816, 32 words: device name and firmware) first in each poll, then the order (100), void and status (120), offered current (126), CP state (139) and error word (150).

A charger, or the Modbus TCP to RTU gateway in front of it, that was off, restarting or held by another client when FTW started used up every try while answering nothing. The driver then sent nothing and never set the model until FTW restarted it.

Change

  • A miss counts only in a poll where another read answered, so a silent charger uses up no tries and is read again on the first poll it answers. A register that misses three times on a charger that does answer is asked again every five minutes instead of never.
  • A reply counts only when every word asked for came back, not just the last.
  • The model is read last, after the ev stream, and only once the charger has answered in that poll.
  • driver_cleanup resets the model flag and the new poll state.
  • Control is unchanged: driver_command and driver_default_mode write as before and read nothing. The ev stream still goes out only when the order (100) or the car state (139) answered.

Test evidence

  • test_schrack_ev_wakes.py, eleven tests. Ten fail on 1.1.0 and all pass on 1.1.1:
    • test_wakes_after_silence.lua (shared with the other PRs in this series): silent from start-up, silent mid-session, each register refused six times;
    • ten silent polls, then the car state, offered current, charger limit, reason and model on the first poll that answers;
    • the model read after the charger's state, not before it;
    • no ev and no model read while neither the order nor the car state answers;
    • each of 100, 120, 126, 139, 150 and 816 asked again within five minutes after three refusals.
    • The eleventh, fields left out when 120, 126 and 150 do not answer, passes on 1.1.0 too.
  • test_schrack_ev_control.py passes unchanged.
  • make test-driver ID=schrack_ev: 52 passed, 14 skipped.
  • make absent-register-report ID=schrack_ev: every address settles.
  • make invented-number-report ID=schrack_ev: none. The driver was not in the baseline.
  • make check: 5585 passed, 927 skipped.

Not yet verified

  • No hardware run. The case needs a CION, or its gateway, that is off or held by another client when FTW starts. The control path stays experimental as before.
  • CHANGELOG.md and drivers/tests/lua_harness/test_wakes_after_silence.lua are shared with the other PRs in this series; whichever merges later needs a rebase there.
  • After merge, FTW's pin in drivers/BUNDLED_SOURCE.json has to move.

🤖 Generated with Claude Code

Every read went through a guard that left a register alone until restart
after three misses, and the model block (816) was read first in each poll.
A charger, or its Modbus TCP to RTU gateway, that was off, restarting or
held by another client at start-up used up every try while answering
nothing. The driver then sent nothing and never set the model until FTW
restarted it.

A miss now counts only in a poll where another read answered, and a
register that misses three times on a charger that does answer is asked
again every five minutes. A reply counts only when every word asked for
came back. The model is read last, once the charger has answered in that
poll. The ev stream still goes out only when the order (100) or the car
state (139) answered. driver_command and driver_default_mode are unchanged.

test_schrack_ev_wakes.py fails on 1.1.0 (10 of 11 cases; the eleventh
checks fields left out, which 1.1.0 already did) and passes on 1.1.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T05:02:44.878334Z bae8372 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant