AP_BattMonitor_Sum.h 767 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include "AP_BattMonitor.h"
  3. #include "AP_BattMonitor_Backend.h"
  4. class AP_BattMonitor_Sum : public AP_BattMonitor_Backend
  5. {
  6. public:
  7. /// Constructor
  8. AP_BattMonitor_Sum(AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params &params, uint8_t instance);
  9. /// Read the battery voltage and current. Should be called at 10hz
  10. void read() override;
  11. /// returns true if battery monitor provides consumed energy info
  12. bool has_consumed_energy() const override { return has_current(); }
  13. /// returns true if battery monitor provides current info
  14. bool has_current() const override { return _has_current; }
  15. void init(void) override {}
  16. private:
  17. uint8_t _instance;
  18. bool _has_current;
  19. };