dronecan: log cumulative bus-off count to blackbox slow frame - #11729
dronecan: log cumulative bus-off count to blackbox slow frame#11729daijoubu wants to merge 2 commits into
Conversation
|
Just an FYI for contributors: The tentative schedule for INAV 10 is to have a full release in mid December. That means RC2 needs to be in early to mid November, which places INAV 10.0RC1 at September 1. Please plan to have any new features for INAV 10.0 ready for RC1 no later than September 1. After that, 10.1 will follow about six to seven months later. |
17d2370 to
5fa94cb
Compare
Adds droneCANBusOffCount to the blackbox S-frame, sourced from the existing dronecanGetBusOffCount() counter, so intermittent CAN bus faults are diagnosable from flight logs instead of requiring a live `dronecan` CLI session. TEC/REC/LEC/state and RX-drop-count were considered and dropped/deferred (see PLAN.md) as poor fits for the slow frame's throttled, change-triggered sampling model.
5fa94cb to
ece7fb2
Compare
|
RAM / Flash usage vs. base branch — commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #11729 247 targets built. Find your board's
|
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoBlackbox: log DroneCAN cumulative bus-off count in slow (S) frame
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Inefficient predictor for counter
|
|
Thanks for the PR — logging the cumulative DroneCAN bus-off count to the blackbox slow frame is a nice, small addition. While reviewing I noticed the Qodo finding and wanted to weigh in: the new field is declared with One question from me: is the raw cumulative count what you want to log, or would a delta/rate also be useful for diagnosing bus-off events in the field? The cumulative count is great for "has this ever happened", but for "when is it happening" a per-frame delta in a faster frame might complement it. Happy to defer to your intent — just curious. Also: the PR targets Other than the predictor question, this looks clean — +17/−1, no RAM/flash impact. Would you be able to make the |
|
Thanks for taking a look, and for the FYI on the 10.0 RC1 date. On the predictor: pushing back on the premise rather than repeating my earlier trace (full analysis here) — That actually means the two existing S-frame fields declared On cumulative vs. delta/rate: cumulative-only, deliberately. Bus-off fires when the CAN TEC (Tx error counter) hits 256, incrementing 8 per transmit error — at today's DroneCAN transmit rate that's 30+ seconds of accumulated errors before bus-off actually trips (it'll shorten once actuator traffic increases, but the accumulation window doesn't go away). That window means a bus-off event can't be cleanly tied back to the specific environmental condition that caused the underlying transmit errors regardless of how finely we log it — a delta/rate field wouldn't fix that. What this field is actually for is coarser: a blackbox record that the CAN hardware was bad, so if sensor data went bad or servo control was lost in the same flight, that's attributable to a hardware fault rather than a software bug. I also considered logging the raw TEC/REC counters, but they're too fast-changing for the slow frame to begin with — they change faster than the DroneCAN service even dispatches, so any sample would be a near-random snapshot rather than meaningful state, and some nonzero TEC/REC is normal anyway. That's better suited to live CLI inspection during bench testing than blackbox logging. Given RC1 is close, my suggestion is to merge this as-is ( |
Summary
Adds
droneCANBusOffCountto the blackbox slow (S) frame, sourced from the existingdronecanGetBusOffCount()counter, so intermittent CAN bus faults are diagnosable from flight logs instead of requiring a livedronecanCLI session.Changes
droneCANBusOffCountfield in the blackbox S-frame (UNSIGNED_VB,PREDICT(0)), gated behindUSE_DRONECANescRPM/escTemperaturefields (field table row, struct member, write, load)Testing
blackbox_decode --debug: the new S-frame field decodes correctly and at the expected byte length across all 214 slow frames in the logCode Review
Reviewed with inav-code-review agent — no CRITICAL or IMPORTANT issues found.