mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 04:33:33 +08:00
voltage & current scaling: use px4_arch_adc_dn_fullcount() instead of 4096
Fixes the scaling on h7 boards (the ADC has 16 bits resolution).
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "parameters.h"
|
||||
|
||||
#include <px4_platform_common/log.h>
|
||||
#include <drivers/drv_adc.h>
|
||||
|
||||
namespace battery_status
|
||||
{
|
||||
@@ -67,7 +68,7 @@ int update_parameters(const ParameterHandles ¶meter_handles, Parameters &par
|
||||
|
||||
} else if (parameters.battery_voltage_scaling < 0.0f) {
|
||||
/* apply scaling according to defaults if set to default */
|
||||
parameters.battery_voltage_scaling = (3.3f / 4096);
|
||||
parameters.battery_voltage_scaling = (3.3f / px4_arch_adc_dn_fullcount());
|
||||
param_set_no_notification(parameter_handles.battery_voltage_scaling, ¶meters.battery_voltage_scaling);
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ int update_parameters(const ParameterHandles ¶meter_handles, Parameters &par
|
||||
|
||||
} else if (parameters.battery_current_scaling < 0.0f) {
|
||||
/* apply scaling according to defaults if set to default */
|
||||
parameters.battery_current_scaling = (3.3f / 4096);
|
||||
parameters.battery_current_scaling = (3.3f / px4_arch_adc_dn_fullcount());
|
||||
param_set_no_notification(parameter_handles.battery_current_scaling, ¶meters.battery_current_scaling);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user