|
|
|
@ -49,9 +49,11 @@ static constexpr int DEFAULT_V_CHANNEL[1] = {0};
@@ -49,9 +49,11 @@ static constexpr int DEFAULT_V_CHANNEL[1] = {0};
|
|
|
|
|
static constexpr int DEFAULT_I_CHANNEL[1] = {0}; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
AnalogBattery::AnalogBattery(int index, ModuleParams *parent, const int sample_interval_us, const uint8_t source) : |
|
|
|
|
AnalogBattery::AnalogBattery(int index, ModuleParams *parent, const int sample_interval_us, const uint8_t source, |
|
|
|
|
const uint8_t priority) : |
|
|
|
|
Battery(index, parent, sample_interval_us, source) |
|
|
|
|
{ |
|
|
|
|
Battery::setPriority(priority); |
|
|
|
|
char param_name[17]; |
|
|
|
|
|
|
|
|
|
_analog_param_handles.v_offs_cur = param_find("BAT_V_OFFS_CURR"); |
|
|
|
@ -70,8 +72,7 @@ AnalogBattery::AnalogBattery(int index, ModuleParams *parent, const int sample_i
@@ -70,8 +72,7 @@ AnalogBattery::AnalogBattery(int index, ModuleParams *parent, const int sample_i
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
AnalogBattery::updateBatteryStatusADC(hrt_abstime timestamp, float voltage_raw, float current_raw, |
|
|
|
|
int priority) |
|
|
|
|
AnalogBattery::updateBatteryStatusADC(hrt_abstime timestamp, float voltage_raw, float current_raw) |
|
|
|
|
{ |
|
|
|
|
float voltage_v = voltage_raw * _analog_params.v_div; |
|
|
|
|
float current_a = (current_raw - _analog_params.v_offs_cur) * _analog_params.a_per_v; |
|
|
|
@ -80,8 +81,7 @@ AnalogBattery::updateBatteryStatusADC(hrt_abstime timestamp, float voltage_raw,
@@ -80,8 +81,7 @@ AnalogBattery::updateBatteryStatusADC(hrt_abstime timestamp, float voltage_raw,
|
|
|
|
|
(BOARD_ADC_OPEN_CIRCUIT_V <= BOARD_VALID_UV || is_valid()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Battery::updateBatteryStatus(timestamp, voltage_v, current_a, connected, |
|
|
|
|
priority); |
|
|
|
|
Battery::updateBatteryStatus(timestamp, voltage_v, current_a, connected); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool AnalogBattery::is_valid() |
|
|
|
|