mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 06:43:34 +08:00
Update adc.cpp
This commit is contained in:
committed by
Lorenz Meier
parent
9833ef13fb
commit
69d0a78c54
@@ -350,12 +350,14 @@ ADC::update_system_power(hrt_abstime now)
|
|||||||
system_power.voltage5V_v = 0;
|
system_power.voltage5V_v = 0;
|
||||||
|
|
||||||
#if defined(ADC_5V_RAIL_SENSE)
|
#if defined(ADC_5V_RAIL_SENSE)
|
||||||
|
|
||||||
for (unsigned i = 0; i < _channel_count; i++) {
|
for (unsigned i = 0; i < _channel_count; i++) {
|
||||||
if (_samples[i].am_channel == ADC_5V_RAIL_SENSE) {
|
if (_samples[i].am_channel == ADC_5V_RAIL_SENSE) {
|
||||||
// it is 2:1 scaled
|
// it is 2:1 scaled
|
||||||
system_power.voltage5V_v = _samples[i].am_data * (6.6f / 4096);
|
system_power.voltage5V_v = _samples[i].am_data * (6.6f / 4096);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Note once the board_config.h provides BOARD_ADC_USB_CONNECTED,
|
/* Note once the board_config.h provides BOARD_ADC_USB_CONNECTED,
|
||||||
|
|||||||
Reference in New Issue
Block a user