I’m having trouble getting the battery voltage measurement from the HAKRC Mini F4 (a clone of OmnibusF4). I’m starting from this hwdef: ArduPilot/ardupilot#11678, which works well but doesn’t have the voltage measurement set up.
In the config for Betaflight, ADC_BATT is on C01. https://github.com/betaflight/unified-targets/blob/master/configs/default/HARC-HAKRCF405.config
So in my Ardupilot hwdef.dat, I put this: PC1 BAT_VOLT_SENS ADC1 SCALE(1)
And I see in STM32F405xx.py that PC1 maps to pin 11
So I put this in hwdef.dat: define HAL_BATT_VOLT_PIN 11
(Do I need to define it in hwdef.dat, or will setting the BATT_VOLT_PIN param to 11 after the build be sufficient?)
Anyway, this doesn’t give me the voltage and I’m not sure why. It is reading something; but definitely not the voltage. It does seem to be some ADC reading though. I’ve adjusted BATT_VOLT_MULT to yield a correct voltage with a 2s battery, but then when I switch to a 3s it’s not correct.
Any ideas of what I’m doing wrong here? Or any other helpful resources on working with hwdef?