Suppress placeholder BMS faults during startup grace#92
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refines BMS startup behavior so placeholder telemetry values aren’t interpreted as real BMS data, by explicitly tracking when BMS status has been requested and when the first real sample has been received.
Changes:
- Add
status_requested/status_receivedstate to BMS telemetry handling, and gate fault evaluation until a request is made and a sample arrives (or a request timeout occurs). - Route Lisp bridge BMS writes through
bms_request_status/bms_store_statushelpers instead of directly mutating the BMS struct. - Update the Lisp BMS loop to call
ext-bmsearly to register a status request.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main.c | Updates ext_bms to either record a status request (no args) or store a received sample (with args). |
| src/bms.h | Extends BMS state to track request/receipt and adds new helper APIs. |
| src/bms.c | Implements request/receive tracking and gates connection-fault logic until after a request. |
| lisp/bms.lisp | Adjusts the BMS loop to call ext-bms up front to mark a request before reading and forwarding values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e77b09a to
ca54db3
Compare
|
code review made me unsure about this and then I thought about it. minimal fix posted instead. sorry about the wild ride lmao. |
ede6bdc to
62d78af
Compare
|
Which case is your code fixing? Seems to me they result in identical behavior because at startup |
|
before: 17d3c61 was supposed to fix this but didn't exactly do it right. To clarify the scope: with a healthy BMS this is likely only present until the BMS Lisp thread makes its first ext-bms call, which normally happens almost immediately. It persists through the startup grace period only when no BMS snapshot is forwarded. So this is primarily a correctness fix for the intended grace period. |
Prevent the startup BMS message-age sentinel from falling through to telemetry threshold checks during the existing grace period.
While BMS data is stale,
bms_update()now returns without reporting telemetry faults until the grace period expires. Afterward it reports the existing connection fault; fresh telemetry continues through the existing threshold checks unchanged.