mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
battery-monitoring: allow disabling analog battery monitoring through BAT{i}_V_CHANNEL param
This commit is contained in:
parent
5125059b8f
commit
db85e12b9f
@ -127,7 +127,10 @@ bool AnalogBattery::is_valid()
|
||||
|
||||
int AnalogBattery::get_voltage_channel()
|
||||
{
|
||||
if (_analog_params.v_channel >= 0) {
|
||||
if (_analog_params.v_channel == V_CHANNEL_DISABLED) {
|
||||
return -1;
|
||||
|
||||
} else if (_analog_params.v_channel >= 0) {
|
||||
return _analog_params.v_channel;
|
||||
|
||||
} else {
|
||||
@ -135,6 +138,7 @@ int AnalogBattery::get_voltage_channel()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int AnalogBattery::get_current_channel()
|
||||
{
|
||||
if (_analog_params.i_channel >= 0) {
|
||||
|
||||
@ -94,6 +94,9 @@ protected:
|
||||
virtual void updateParams() override;
|
||||
|
||||
private:
|
||||
|
||||
static constexpr int V_CHANNEL_DISABLED = -2;
|
||||
|
||||
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
|
||||
uint8_t _arming_state{0};
|
||||
|
||||
|
||||
@ -41,7 +41,9 @@ parameters:
|
||||
short: Battery ${i} Voltage ADC Channel
|
||||
long: |
|
||||
This parameter specifies the ADC channel used to monitor voltage of main power battery.
|
||||
A value of -1 means to use the board default.
|
||||
A value of -1 means to use the board default. A value of -2 disables analog monitoring.
|
||||
This is useful when the FMU supports both analog and digital voltage monitoring and you want
|
||||
to use digital monitoring exclusively.
|
||||
|
||||
type: int32
|
||||
reboot_required: true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user