GCS_MAVLink: add default instance to get_battery_remaining_percentage, make it const

This commit is contained in:
Willian Galvani 2021-02-23 11:52:41 -03:00 committed by Jacob Walser
parent e482651c0b
commit d583d157e7
3 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ protected:
uint64_t capabilities() const override;
uint8_t get_battery_remaining_percentage() override { return -1; };
uint8_t get_battery_remaining_percentage(uint8_t instance) const override { return -1; };
private:

View File

@ -431,7 +431,7 @@ protected:
virtual float vfr_hud_airspeed() const;
virtual int16_t vfr_hud_throttle() const { return 0; }
virtual float vfr_hud_alt() const;
virtual uint8_t get_battery_remaining_percentage();
virtual uint8_t get_battery_remaining_percentage(uint8_t instance=0) const;
static constexpr const float magic_force_arm_value = 2989.0f;
static constexpr const float magic_force_disarm_value = 21196.0f;

View File

@ -4662,9 +4662,9 @@ void GCS_MAVLINK::manual_override(RC_Channel *c, int16_t value_in, const uint16_
c->set_override(override_value, tnow);
}
uint8_t GCS_MAVLINK::get_battery_remaining_percentage() {
uint8_t GCS_MAVLINK::get_battery_remaining_percentage(uint8_t instance) const {
const AP_BattMonitor &battery = AP::battery();
return battery.capacity_remaining_pct();
return battery.capacity_remaining_pct(instance);
}
GCS &gcs()