mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 05:21:35 +08:00
Update ADC voltage calculation instances to avoid divide by integer.
This commit is contained in:
@@ -281,6 +281,7 @@ int board_adc_init()
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int
|
||||
ADC::init()
|
||||
{
|
||||
@@ -401,7 +402,7 @@ ADC::update_system_power(hrt_abstime now)
|
||||
|
||||
if (_samples[i].am_channel == ADC_SCALED_V5_SENSE) {
|
||||
// it is 2:1 scaled
|
||||
system_power.voltage5V_v = _samples[i].am_data * (ADC_V5_V_FULL_SCALE / 4096);
|
||||
system_power.voltage5V_v = _samples[i].am_data * (ADC_V5_V_FULL_SCALE / 4096.0f);
|
||||
cnt--;
|
||||
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user