Usermod class vars pt2: enabled default value

This commit is contained in:
Ewoud
2023-03-15 18:18:11 +01:00
parent 7337efec02
commit ff6d5136ac
4 changed files with 5 additions and 5 deletions

View File

@@ -159,7 +159,7 @@ class UsermodTemperature : public Usermod {
#endif
public:
UsermodTemperature(const char *name):Usermod(name) {} //WLEDMM: this shouldn't be necessary (passthrough of constructor), maybe because Usermod is an abstract class
UsermodTemperature(const char *name, bool enabled):Usermod(name, enabled) {} //WLEDMM: this shouldn't be necessary (passthrough of constructor), maybe because Usermod is an abstract class
void setup() {
int retries = 10;

View File

@@ -107,7 +107,7 @@ class MPU6050Driver : public Usermod {
static const char _INT_pin[];
public:
MPU6050Driver(const char *name):Usermod(name) {} //WLEDMM: this shouldn't be necessary (passthrough of constructor), maybe because Usermod is an abstract class
MPU6050Driver(const char *name, bool enabled):Usermod(name, enabled) {} //WLEDMM: this shouldn't be necessary (passthrough of constructor), maybe because Usermod is an abstract class
bool dmpReady = false; // set true if DMP init was successful // WLEDMM expose this info in public interface
// orientation/motion vars

View File

@@ -264,7 +264,7 @@ class Usermod {
bool enabled = false; //WLEDMM
const char *_name; //WLEDMM
public:
Usermod(const char *name = nullptr) { um_data = nullptr; _name = name;}
Usermod(const char *_name = nullptr, bool enabled=false) { um_data = nullptr; this->_name = _name; this->enabled=enabled;}
virtual ~Usermod() { if (um_data) delete um_data; }
virtual void setup() = 0; // pure virtual, has to be overriden
virtual void loop() = 0; // pure virtual, has to be overriden

View File

@@ -219,7 +219,7 @@ void registerUsermods()
#endif
#ifdef USERMOD_DALLASTEMPERATURE
usermods.add(new UsermodTemperature("Temperature"));
usermods.add(new UsermodTemperature("Temperature", true));
#endif
#ifdef USERMOD_SN_PHOTORESISTOR
@@ -385,7 +385,7 @@ void registerUsermods()
#ifdef USERMOD_MPU6050_IMU
usermods.add(new MPU6050Driver("mpu6050-IMU"));
usermods.add(new MPU6050Driver("mpu6050-IMU", true));
#endif
#ifdef USERMOD_GAMES