mirror of https://github.com/ArduPilot/ardupilot
AP_Compass: Refactor battery current backend
This commit is contained in:
parent
b07d65c1f3
commit
58dbbd6d0e
|
@ -81,8 +81,9 @@ void AP_Compass_Backend::correct_field(Vector3f &mag, uint8_t i)
|
||||||
state.motor_offset = mot * _compass._thr;
|
state.motor_offset = mot * _compass._thr;
|
||||||
} else if (_compass._motor_comp_type == AP_COMPASS_MOT_COMP_CURRENT) {
|
} else if (_compass._motor_comp_type == AP_COMPASS_MOT_COMP_CURRENT) {
|
||||||
AP_BattMonitor &battery = AP::battery();
|
AP_BattMonitor &battery = AP::battery();
|
||||||
if (battery.has_current()) {
|
float current;
|
||||||
state.motor_offset = mot * battery.current_amps();
|
if (battery.current_amps(current)) {
|
||||||
|
state.motor_offset = mot * current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue