Line data Source code
1 : #pragma once 2 : 3 : #include "AP_BattMonitor_Backend.h" 4 : 5 : #if AP_BATTERY_SUM_ENABLED 6 : 7 : #include "AP_BattMonitor.h" 8 : 9 : class AP_BattMonitor_Sum : public AP_BattMonitor_Backend 10 : { 11 : public: 12 : 13 : /// Constructor 14 : AP_BattMonitor_Sum(AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params ¶ms, uint8_t instance); 15 : 16 : /// Read the battery voltage and current. Should be called at 10hz 17 : void read() override; 18 : 19 : /// returns true if battery monitor provides consumed energy info 20 0 : bool has_consumed_energy() const override { return has_current(); } 21 : 22 : /// returns true if battery monitor provides current info 23 0 : bool has_current() const override { return _has_current; } 24 : 25 : /// returns true if battery monitor provides temperature info 26 0 : bool has_temperature() const override { return _has_temperature; } 27 : 28 0 : void init(void) override {} 29 : 30 : static const struct AP_Param::GroupInfo var_info[]; 31 : 32 : private: 33 : 34 : AP_Int16 _sum_mask; 35 : uint8_t _instance; 36 : bool _has_current; 37 : bool _has_temperature; 38 : }; 39 : 40 : #endif // AP_BATTERY_SUM_ENABLED