Repository navigation
Conversation
adcValues is in DMA_RAM, which on H7 is a NOLOAD section that startup does not zero. adcInstanceInit() returns early if the ADC or its DMA fails to start, after the channels were marked enabled, so adcGetChannel() then returned whatever the RAM held instead of 0: random battery voltage and current. Clear the buffer before the ADC starts, as iNavFlight#12119 does on F7.
|
ⓘ 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 QodoClear the H7 ADC buffer before initialization
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
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 route each severity your way: inline, summary, both, or drop |
|
RAM / Flash usage vs. base commit
See RAM/flash optimization guide for techniques to reduce usage. |
|
Test firmware build ready — commit Download firmware for PR #12123 251 targets built. Find your board's
|
On H7
adcValuessits inDMA_RAM, a NOLOAD section in D2 SRAM that is never zeroed. If the ADC or its DMA does notstart (any of the early returns in
adcInstanceInit()), battery voltage, current, RSSI and airspeed are computed fromwhatever that RAM held: the previous boot's readings after a soft reset, random values after a power-up. They now
read 0. #12119, which moves the F7 buffer into
DMA_RAM, clears it the same way.Tested
On a KAKUTEH7MINI, with a test-only build (not in this PR) that skips
HAL_ADC_Start_DMA()for one soft reset andprints the buffer in
status:Size