mirror of
https://github.com/wled/WLED.git
synced 2025-07-15 23:06:36 +00:00
Rename Battery classes
This commit is contained in:
parent
05a8c692f2
commit
18e9f9c304
@ -7,7 +7,7 @@
|
||||
* Battery base class
|
||||
* all other battery classes should inherit from this
|
||||
*/
|
||||
class Battery
|
||||
class UMBattery
|
||||
{
|
||||
private:
|
||||
|
||||
@ -25,7 +25,7 @@ class Battery
|
||||
}
|
||||
|
||||
public:
|
||||
Battery()
|
||||
UMBattery()
|
||||
{
|
||||
this->setVoltageMultiplier(USERMOD_BATTERY_VOLTAGE_MULTIPLIER);
|
||||
this->setCalibration(USERMOD_BATTERY_CALIBRATION);
|
@ -131,5 +131,4 @@ typedef struct bconfig_t
|
||||
float voltageMultiplier;
|
||||
} batteryConfig;
|
||||
|
||||
|
||||
#endif
|
@ -2,18 +2,18 @@
|
||||
#define UMBLion_h
|
||||
|
||||
#include "../battery_defaults.h"
|
||||
#include "../battery.h"
|
||||
#include "../UMBattery.h"
|
||||
|
||||
/**
|
||||
* Lion Battery
|
||||
* LiOn Battery
|
||||
*
|
||||
*/
|
||||
class Lion : public Battery
|
||||
class LionUMBattery : public UMBattery
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
Lion() : Battery()
|
||||
LionUMBattery() : UMBattery()
|
||||
{
|
||||
this->setMinVoltage(USERMOD_BATTERY_LION_MIN_VOLTAGE);
|
||||
this->setMaxVoltage(USERMOD_BATTERY_LION_MAX_VOLTAGE);
|
@ -2,18 +2,18 @@
|
||||
#define UMBLipo_h
|
||||
|
||||
#include "../battery_defaults.h"
|
||||
#include "../battery.h"
|
||||
#include "../UMBattery.h"
|
||||
|
||||
/**
|
||||
* Lipo Battery
|
||||
* LiPo Battery
|
||||
*
|
||||
*/
|
||||
class Lipo : public Battery
|
||||
class LipoUMBattery : public UMBattery
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
Lipo() : Battery()
|
||||
LipoUMBattery() : UMBattery()
|
||||
{
|
||||
this->setMinVoltage(USERMOD_BATTERY_LIPO_MIN_VOLTAGE);
|
||||
this->setMaxVoltage(USERMOD_BATTERY_LIPO_MAX_VOLTAGE);
|
@ -2,18 +2,18 @@
|
||||
#define UMBUnkown_h
|
||||
|
||||
#include "../battery_defaults.h"
|
||||
#include "../battery.h"
|
||||
#include "../UMBattery.h"
|
||||
|
||||
/**
|
||||
* Lion Battery
|
||||
* Unkown / Default Battery
|
||||
*
|
||||
*/
|
||||
class Unkown : public Battery
|
||||
class UnkownUMBattery : public UMBattery
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
Unkown() : Battery()
|
||||
UnkownUMBattery() : UMBattery()
|
||||
{
|
||||
this->setMinVoltage(USERMOD_BATTERY_UNKOWN_MIN_VOLTAGE);
|
||||
this->setMaxVoltage(USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE);
|
@ -2,10 +2,10 @@
|
||||
|
||||
#include "wled.h"
|
||||
#include "battery_defaults.h"
|
||||
#include "battery.h"
|
||||
#include "types/unkown.h"
|
||||
#include "types/lion.h"
|
||||
#include "types/lipo.h"
|
||||
#include "UMBattery.h"
|
||||
#include "types/UnkownUMBattery.h"
|
||||
#include "types/LionUMBattery.h"
|
||||
#include "types/LiPoUMBattery.h"
|
||||
|
||||
/*
|
||||
* Usermod by Maximilian Mewes
|
||||
@ -19,7 +19,7 @@ class UsermodBattery : public Usermod
|
||||
// battery pin can be defined in my_config.h
|
||||
int8_t batteryPin = USERMOD_BATTERY_MEASUREMENT_PIN;
|
||||
|
||||
Battery* bat = new Unkown();
|
||||
UMBattery* bat = new UnkownUMBattery();
|
||||
batteryConfig cfg;
|
||||
|
||||
// how often to read the battery voltage
|
||||
@ -142,9 +142,9 @@ class UsermodBattery : public Usermod
|
||||
|
||||
// plug in the right battery type
|
||||
if(cfg.type == (batteryType)lipo) {
|
||||
bat = new Lipo();
|
||||
bat = new LipoUMBattery();
|
||||
} else if(cfg.type == (batteryType)lion) {
|
||||
bat = new Lion();
|
||||
bat = new LipoUMBattery();
|
||||
}
|
||||
|
||||
// update the choosen battery type with configured values
|
||||
|
Loading…
x
Reference in New Issue
Block a user