Line data Source code
1 : #pragma once 2 : 3 : #include "AP_BattMonitor.h" 4 : #include "AP_BattMonitor_Analog.h" 5 : 6 : #if AP_BATTERY_SYNTHETIC_CURRENT_ENABLED 7 : class AP_BattMonitor_Synthetic_Current : public AP_BattMonitor_Analog 8 : { 9 : public: 10 : 11 : /// Constructor 12 : AP_BattMonitor_Synthetic_Current(AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params ¶ms); 13 : 14 : /// Read the battery voltage and current. Should be called at 10hz 15 : void read() override; 16 : 17 : /// returns true if battery monitor provides consumed energy info 18 0 : bool has_consumed_energy() const override { return true; } 19 : 20 : /// returns true if battery monitor provides current info 21 0 : bool has_current() const override { return true; } 22 : 23 0 : void init(void) override {} 24 : 25 : static const struct AP_Param::GroupInfo var_info[]; 26 : 27 : protected: 28 : 29 : AP_Float _max_voltage; /// maximum battery voltage used in current calculation 30 : }; 31 : #endif