Browse Source

AP_BattMonitor: complete rename of SMBus_Maxell to Generic

c415-sdk
Randy Mackay 5 years ago committed by WickedShell
parent
commit
f869cd9aa6
  1. 8
      libraries/AP_BattMonitor/AP_BattMonitor.cpp
  2. 4
      libraries/AP_BattMonitor/AP_BattMonitor.h
  3. 2
      libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp
  4. 1
      libraries/AP_BattMonitor/AP_BattMonitor_Params.h
  5. 2
      libraries/AP_BattMonitor/AP_BattMonitor_SMBus.h
  6. 10
      libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Generic.cpp
  7. 4
      libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Generic.h

8
libraries/AP_BattMonitor/AP_BattMonitor.cpp

@ -133,11 +133,11 @@ AP_BattMonitor::init()
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR, hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20), 6); 100000, true, 20), 6);
break; break;
case AP_BattMonitor_Params::BattMonitor_TYPE_MAXELL: case AP_BattMonitor_Params::BattMonitor_TYPE_SMBus_Generic:
_params[instance]._i2c_bus.set_default(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL); _params[instance]._i2c_bus.set_default(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL);
drivers[instance] = new AP_BattMonitor_SMBus_Maxell(*this, state[instance], _params[instance], drivers[instance] = new AP_BattMonitor_SMBus_Generic(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR, hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20)); 100000, true, 20));
break; break;
#endif // HAL_BATTMON_SMBUS_ENABLE #endif // HAL_BATTMON_SMBUS_ENABLE
case AP_BattMonitor_Params::BattMonitor_TYPE_BEBOP: case AP_BattMonitor_Params::BattMonitor_TYPE_BEBOP:

4
libraries/AP_BattMonitor/AP_BattMonitor.h

@ -32,7 +32,7 @@ class AP_BattMonitor_Backend;
class AP_BattMonitor_Analog; class AP_BattMonitor_Analog;
class AP_BattMonitor_SMBus; class AP_BattMonitor_SMBus;
class AP_BattMonitor_SMBus_Solo; class AP_BattMonitor_SMBus_Solo;
class AP_BattMonitor_SMBus_Maxell; class AP_BattMonitor_SMBus_Generic;
class AP_BattMonitor_UAVCAN; class AP_BattMonitor_UAVCAN;
class AP_BattMonitor class AP_BattMonitor
@ -41,7 +41,7 @@ class AP_BattMonitor
friend class AP_BattMonitor_Analog; friend class AP_BattMonitor_Analog;
friend class AP_BattMonitor_SMBus; friend class AP_BattMonitor_SMBus;
friend class AP_BattMonitor_SMBus_Solo; friend class AP_BattMonitor_SMBus_Solo;
friend class AP_BattMonitor_SMBus_Maxell; friend class AP_BattMonitor_SMBus_Generic;
friend class AP_BattMonitor_UAVCAN; friend class AP_BattMonitor_UAVCAN;
friend class AP_BattMonitor_Sum; friend class AP_BattMonitor_Sum;
friend class AP_BattMonitor_FuelFlow; friend class AP_BattMonitor_FuelFlow;

2
libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp

@ -13,7 +13,7 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = {
// @Param: MONITOR // @Param: MONITOR
// @DisplayName: Battery monitoring // @DisplayName: Battery monitoring
// @Description: Controls enabling monitoring of the battery's voltage and current // @Description: Controls enabling monitoring of the battery's voltage and current
// @Values: 0:Disabled,3:Analog Voltage Only,4:Analog Voltage and Current,5:Solo,6:Bebop,7:SMBus-Maxell,8:UAVCAN-BatteryInfo,9:BLHeli ESC,10:SumOfFollowing,11:FuelFlow,12:FuelLevelPWM,13:SMBUS-SUI3,14:SMBUS-SUI6,15:NeoDesign // @Values: 0:Disabled,3:Analog Voltage Only,4:Analog Voltage and Current,5:Solo,6:Bebop,7:SMBus-Maxell,8:UAVCAN-BatteryInfo,9:BLHeli ESC,10:SumOfFollowing,11:FuelFlow,12:FuelLevelPWM,13:SMBUS-SUI3,14:SMBUS-SUI6,15:NeoDesign,16:SMBus-Generic
// @User: Standard // @User: Standard
// @RebootRequired: True // @RebootRequired: True
AP_GROUPINFO_FLAGS("MONITOR", 1, AP_BattMonitor_Params, _type, BattMonitor_TYPE_NONE, AP_PARAM_FLAG_ENABLE), AP_GROUPINFO_FLAGS("MONITOR", 1, AP_BattMonitor_Params, _type, BattMonitor_TYPE_NONE, AP_PARAM_FLAG_ENABLE),

1
libraries/AP_BattMonitor/AP_BattMonitor_Params.h

@ -28,6 +28,7 @@ public:
BattMonitor_TYPE_SUI3 = 13, BattMonitor_TYPE_SUI3 = 13,
BattMonitor_TYPE_SUI6 = 14, BattMonitor_TYPE_SUI6 = 14,
BattMonitor_TYPE_NeoDesign = 15, BattMonitor_TYPE_NeoDesign = 15,
BattMonitor_TYPE_SMBus_Generic = 16,
}; };
// low voltage sources (used for BATT_LOW_TYPE parameter) // low voltage sources (used for BATT_LOW_TYPE parameter)

2
libraries/AP_BattMonitor/AP_BattMonitor_SMBus.h

@ -99,4 +99,4 @@ protected:
// include specific implementations // include specific implementations
#include "AP_BattMonitor_SMBus_Solo.h" #include "AP_BattMonitor_SMBus_Solo.h"
#include "AP_BattMonitor_SMBus_Maxell.h" #include "AP_BattMonitor_SMBus_Generic.h"

10
libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Generic.cpp

@ -2,7 +2,7 @@
#include <AP_Common/AP_Common.h> #include <AP_Common/AP_Common.h>
#include <AP_Math/AP_Math.h> #include <AP_Math/AP_Math.h>
#include "AP_BattMonitor.h" #include "AP_BattMonitor.h"
#include "AP_BattMonitor_SMBus_Maxell.h" #include "AP_BattMonitor_SMBus_Generic.h"
#include <utility> #include <utility>
uint8_t maxell_cell_ids[] = { 0x3f, // cell 1 uint8_t maxell_cell_ids[] = { 0x3f, // cell 1
@ -30,14 +30,14 @@ uint8_t maxell_cell_ids[] = { 0x3f, // cell 1
*/ */
// Constructor // Constructor
AP_BattMonitor_SMBus_Maxell::AP_BattMonitor_SMBus_Maxell(AP_BattMonitor &mon, AP_BattMonitor_SMBus_Generic::AP_BattMonitor_SMBus_Generic(AP_BattMonitor &mon,
AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor::BattMonitor_State &mon_state,
AP_BattMonitor_Params &params, AP_BattMonitor_Params &params,
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev) AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev)
: AP_BattMonitor_SMBus(mon, mon_state, params, std::move(dev)) : AP_BattMonitor_SMBus(mon, mon_state, params, std::move(dev))
{} {}
void AP_BattMonitor_SMBus_Maxell::timer() void AP_BattMonitor_SMBus_Generic::timer()
{ {
// check if PEC is supported // check if PEC is supported
if (!check_pec_support()) { if (!check_pec_support()) {
@ -90,7 +90,7 @@ void AP_BattMonitor_SMBus_Maxell::timer()
} }
// read_block - returns number of characters read if successful, zero if unsuccessful // read_block - returns number of characters read if successful, zero if unsuccessful
uint8_t AP_BattMonitor_SMBus_Maxell::read_block(uint8_t reg, uint8_t* data, bool append_zero) const uint8_t AP_BattMonitor_SMBus_Generic::read_block(uint8_t reg, uint8_t* data, bool append_zero) const
{ {
// get length // get length
uint8_t bufflen; uint8_t bufflen;
@ -135,7 +135,7 @@ uint8_t AP_BattMonitor_SMBus_Maxell::read_block(uint8_t reg, uint8_t* data, bool
// check if PEC supported with the version value in SpecificationInfo() function // check if PEC supported with the version value in SpecificationInfo() function
// returns true once PEC is confirmed as working or not working // returns true once PEC is confirmed as working or not working
bool AP_BattMonitor_SMBus_Maxell::check_pec_support() bool AP_BattMonitor_SMBus_Generic::check_pec_support()
{ {
// exit immediately if we have already confirmed pec support // exit immediately if we have already confirmed pec support
if (_pec_confirmed) { if (_pec_confirmed) {

4
libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Generic.h

@ -8,12 +8,12 @@
#define BATTMONITOR_SMBUS_MAXELL_NUM_CELLS 6 #define BATTMONITOR_SMBUS_MAXELL_NUM_CELLS 6
class AP_BattMonitor_SMBus_Maxell : public AP_BattMonitor_SMBus class AP_BattMonitor_SMBus_Generic : public AP_BattMonitor_SMBus
{ {
public: public:
// Constructor // Constructor
AP_BattMonitor_SMBus_Maxell(AP_BattMonitor &mon, AP_BattMonitor_SMBus_Generic(AP_BattMonitor &mon,
AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor::BattMonitor_State &mon_state,
AP_BattMonitor_Params &params, AP_BattMonitor_Params &params,
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev); AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev);

Loading…
Cancel
Save