Skip to content

F-23: WiThrottle heartbeat (JMRI dead-man stop) never armed #26

Open

Description

@bazauto

Severity: HIGH · Effort: Small · Batch: 2 · Status: Code done in #21 (68452a5), awaiting bench verification

Found in the second full review of the firmware. Recorded with the rest of the pass (F-19…F-44) in docs/REVIEW_REMEDIATION_PLAN_2.md, which is where its status is kept.

Description

WiThrottleClient::connect() never sends *+, and nothing sends a periodic *. The repo's own
protocol notes call the heartbeat "CRITICAL". Without it, JMRI never e-stops this device's locos
when the device crashes, reboots, or goes half-open on WiFi — the dead-man switch is simply
off. The device also sends HESP32-S3, where the protocol expects HU<unique-id>.

Plan

  1. Send HU<MAC> (a stable per-device id) and N<name> on connect.
  2. Parse the server's *<seconds> announcement; if non-zero, send *+ and then * at half
    that interval. Sent from the receive task, which wakes at least once a second anyway, so
    the heartbeat needs no task of its own and ends with the session.

Files: WiThrottleClient.h/.cpp

Acceptance Criteria

  • *+ is sent once per session when the server announces a non-zero interval.
  • * is sent at half the announced interval for the life of the session, from the
    receive task (which now wakes every second).
  • HU<station MAC> replaces the malformed HESP32-S3.
  • Unit tests test_withrottle_heartbeat_announcement_arms_monitoring and
    test_withrottle_malformed_heartbeat_is_ignored pass on the board (they compile).
  • Bench: pull the ESP's power with a loco running; JMRI e-stops it within the interval.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions