mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 06:43:34 +08:00
battery-monitoring: allow disabling analog battery monitoring through BAT{i}_V_CHANNEL param
This commit is contained in:
@@ -127,7 +127,10 @@ bool AnalogBattery::is_valid()
|
|||||||
|
|
||||||
int AnalogBattery::get_voltage_channel()
|
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;
|
return _analog_params.v_channel;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -135,6 +138,7 @@ int AnalogBattery::get_voltage_channel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int AnalogBattery::get_current_channel()
|
int AnalogBattery::get_current_channel()
|
||||||
{
|
{
|
||||||
if (_analog_params.i_channel >= 0) {
|
if (_analog_params.i_channel >= 0) {
|
||||||
|
|||||||
@@ -94,6 +94,9 @@ protected:
|
|||||||
virtual void updateParams() override;
|
virtual void updateParams() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static constexpr int V_CHANNEL_DISABLED = -2;
|
||||||
|
|
||||||
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
|
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
|
||||||
uint8_t _arming_state{0};
|
uint8_t _arming_state{0};
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ parameters:
|
|||||||
short: Battery ${i} Voltage ADC Channel
|
short: Battery ${i} Voltage ADC Channel
|
||||||
long: |
|
long: |
|
||||||
This parameter specifies the ADC channel used to monitor voltage of main power battery.
|
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
|
type: int32
|
||||||
reboot_required: true
|
reboot_required: true
|
||||||
|
|||||||
Reference in New Issue
Block a user