|
|
@ -43,6 +43,13 @@ const AP_Param::GroupInfo AP_BattMonitor_Analog::var_info[] = { |
|
|
|
// @User: Standard
|
|
|
|
// @User: Standard
|
|
|
|
AP_GROUPINFO("AMP_OFFSET", 5, AP_BattMonitor_Analog, _curr_amp_offset, AP_BATT_CURR_AMP_OFFSET_DEFAULT), |
|
|
|
AP_GROUPINFO("AMP_OFFSET", 5, AP_BattMonitor_Analog, _curr_amp_offset, AP_BATT_CURR_AMP_OFFSET_DEFAULT), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// @Param: VLT_OFFSET
|
|
|
|
|
|
|
|
// @DisplayName: Volage offset
|
|
|
|
|
|
|
|
// @Description: Voltage offset on voltage pin. This allows for an offset due to a diode. This voltage is subtracted before the scaling is applied
|
|
|
|
|
|
|
|
// @Units: V
|
|
|
|
|
|
|
|
// @User: Advanced
|
|
|
|
|
|
|
|
AP_GROUPINFO("VLT_OFFSET", 6, AP_BattMonitor_Analog, _volt_offset, 0), |
|
|
|
|
|
|
|
|
|
|
|
// Param indexes must be less than 10 to avoid conflict with other battery monitor param tables loaded by pointer
|
|
|
|
// Param indexes must be less than 10 to avoid conflict with other battery monitor param tables loaded by pointer
|
|
|
|
|
|
|
|
|
|
|
|
AP_GROUPEND |
|
|
|
AP_GROUPEND |
|
|
@ -70,7 +77,7 @@ AP_BattMonitor_Analog::read() |
|
|
|
_state.healthy = _volt_pin_analog_source->set_pin(_volt_pin); |
|
|
|
_state.healthy = _volt_pin_analog_source->set_pin(_volt_pin); |
|
|
|
|
|
|
|
|
|
|
|
// get voltage
|
|
|
|
// get voltage
|
|
|
|
_state.voltage = _volt_pin_analog_source->voltage_average() * _volt_multiplier; |
|
|
|
_state.voltage = (_volt_pin_analog_source->voltage_average() - _volt_offset) * _volt_multiplier; |
|
|
|
|
|
|
|
|
|
|
|
// read current
|
|
|
|
// read current
|
|
|
|
if (has_current()) { |
|
|
|
if (has_current()) { |
|
|
|