Conversation
BEEROTORF4, GEPRCF722_BT_HD and SPRACINGF7DUAL define USE_SDCARD but not ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT, so the blackbox device defaulted to BLACKBOX_DEVICE_SERIAL even though the SD card slot is the only onboard logging device on these boards. Fixes iNavFlight#9871
The amperage field was gated on current_meter_type being ADC, a leftover from when the condition was still named FLIGHT_LOG_FIELD_CONDITION_AMPERAGE_ADC. The logged value comes from getAmperage(), which is maintained for every current meter type, so ESC, CRSF, SmartPort, CAN, INA226 and virtual meters produced no amperage field at all. Use isAmperageConfigured(), the same predicate taskUpdateBattery() uses to decide whether an amperage value is updated, so no field is written when there is no current source. Fixes iNavFlight#8966
|
ⓘ 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 QodoFix amperage logging and SD-only blackbox defaults
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can switch off images and animations for a plain-text comment |
Problem
Fixes #8966 and #9871.
With
current_meter_type = ESC(STM32H750, INAV 5.1 and 6.0) the blackbox log has no amperage field at all, whileescTemperatureandescRPMare present (#8966). On a BeeRotor F4,statusreportsSD card: Startup failedwith several freshly formatted cards that work on Betaflight 4.4.3, on INAV 5.1 through 7.1, and the board locks up when the Blackbox tab is opened; the reporter found thatset blackbox_device = SDCARDmakes the card mount, and a maintainer suspected a wrong default (#9871).Cause
src/main/blackbox/blackbox.c:808(maintenance-10.x) writes the amperage field only whencurrent.type == CURRENT_SENSOR_ADC. The value comes fromgetAmperage()(blackbox.c:1831), whichtaskUpdateBattery()maintains for every meter type underisAmperageConfigured()(src/main/sensors/battery.c:680-683,src/main/fc/fc_tasks.c:136).escRPM/escTemperatureare unconditional slow-frame fields (blackbox.c:526-527), so they appear while amperage does not.DEFAULT_BLACKBOX_DEVICE(blackbox.c:96-101) isSERIALunless the target definesENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT.BEEROTORF4/target.h:48-53,GEPRCF722_BT_HD/target.h:79-82andSPRACINGF7DUAL/target.h:119-127defineUSE_SDCARD, have no flash, and lack that define. The only otherUSE_SDCARDtargets without it are ZEEZF7 (SD only on V3, flash default set on purpose) and SITL (USE_SDCARD_SITL).Change
The amperage condition returns
isAmperageConfigured(), so the field is written for every configured current meter type and omitted when there is no current source. The SD-card default define is added to the three targets above; ZEEZF7 and SITL are left as they are.PG_BLACKBOX_CONFIGis not bumped: saved configurations keep theirblackbox_device, only defaults and resets change.Test
Not run on hardware or SITL. Cause verified by reading
blackbox.c:808,battery.c:680-683and the three target headers on maintenance-10.x. Built by fork CI: pending (no run onfix/blackbox-target-defaults, no upstream check on 3961223). Compiled for all targets and the four SITL builds on the fork, green: https://github.com/Raffi1202/inav/actions/runs/34770672196Flash / RAM
Builds clean on all targets. No size comparison yet: the fork build has no baseline for this branch, and the upstream size report runs once CI is released for this PR.
Docs
No documentation change needed:
blackbox_deviceis documented as a target default (docs/Settings.md:614-624),docs/Blackbox.md:19already lists current as a logged value, anddocs/development/targets/common-issues.md:373-383already names the define as the fix for this symptom.