Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions usermods/ADS1115_v2/ADS1115_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@ class ADS1115Usermod : public Usermod {
return USERMOD_ID_ADS1115;
}

const char* getName() override
{
return _name;
}

private:
static const char _name[];
static const uint8_t channelsCount = 8;

ChannelSettings channelSettings[channelsCount] = {
Expand Down Expand Up @@ -252,5 +258,7 @@ class ADS1115Usermod : public Usermod {
}
};

const char ADS1115Usermod::_name[] PROGMEM = "ADS1115";

static ADS1115Usermod ads1115_v2;
REGISTER_USERMOD(ads1115_v2);
5 changes: 5 additions & 0 deletions usermods/AHT10_v2/AHT10_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ class UsermodAHT10 : public Usermod
return USERMOD_ID_AHT10;
}

const char* getName() override
{
return _name;
}

void addToJsonInfo(JsonObject &root) override
{
// if "u" object does not exist yet wee need to create it
Expand Down
7 changes: 7 additions & 0 deletions usermods/Analog_Clock/Analog_Clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern Timezone* tz;

class AnalogClockUsermod : public Usermod {
private:
static const char _name[];
static constexpr uint32_t refreshRate = 50; // per second
static constexpr uint32_t refreshDelay = 1000 / refreshRate;

Expand Down Expand Up @@ -252,8 +253,14 @@ class AnalogClockUsermod : public Usermod {
uint16_t getId() override {
return USERMOD_ID_ANALOG_CLOCK;
}

const char* getName() override {
return _name;
}
};


const char AnalogClockUsermod::_name[] PROGMEM = "Analog Clock";

static AnalogClockUsermod analog_clock;
REGISTER_USERMOD(analog_clock);
5 changes: 5 additions & 0 deletions usermods/Animated_Staircase/Animated_Staircase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ class Animated_Staircase : public Usermod {

uint16_t getId() { return USERMOD_ID_ANIMATED_STAIRCASE; }

const char* getName() override
{
return _name;
}

#ifndef WLED_DISABLE_MQTT
/**
* handling of MQTT message
Expand Down
5 changes: 5 additions & 0 deletions usermods/BH1750_v2/BH1750_v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ class Usermod_BH1750 : public Usermod
return USERMOD_ID_BH1750;
}

inline const char* getName()
{
return _name;
}

};
5 changes: 5 additions & 0 deletions usermods/BME280_v2/BME280_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,11 @@ class UsermodBME280 : public Usermod
uint16_t getId() {
return USERMOD_ID_BME280;
}

const char* getName() override
{
return _name;
}
};

const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280";
Expand Down
13 changes: 13 additions & 0 deletions usermods/BME68X_v2/BME68X_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
public:
/* Public: Functions */
uint16_t getId();
const char* getName();
void loop(); // Loop of the user module called by wled main in loop
void setup(); // Setup of the user module called by wled main
void addToConfig(JsonObject& root); // Extends the settings/user module settings page to include the user module requirements. The settings are written from the wled core to the configuration file.
Expand Down Expand Up @@ -74,6 +75,7 @@

private:
/* Private: Functions */
static const char _name[];
void HomeAssistantDiscovery();
void MQTT_PublishHASensor(const String& name, const String& deviceClass, const String& unitOfMeasurement, const int8_t& digs, const uint8_t& option = 0);
void MQTT_publish(const char* topic, const float& value, const int8_t& dig);
Expand Down Expand Up @@ -864,6 +866,15 @@
return USERMOD_ID_BME68X;
}

/**
* @brief Called by WLED: Returns the user module name
*
* @return const char* User module name
*/
const char* UsermodBME68X::getName() {
return _name;
}


/**
* @brief Returns the current temperature in the scale which is choosen in settings
Expand Down Expand Up @@ -1110,5 +1121,7 @@
}


const char UsermodBME68X::_name[] PROGMEM = "BME68X";

static UsermodBME68X bme68x_v2;
REGISTER_USERMOD(bme68x_v2);
5 changes: 5 additions & 0 deletions usermods/Battery/Battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,11 @@ class UsermodBattery : public Usermod
return USERMOD_ID_BATTERY;
}

const char* getName() override
{
return _name;
}

/**
* get currently active battery type
*/
Expand Down
7 changes: 7 additions & 0 deletions usermods/Cronixie/Cronixie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class UsermodCronixie : public Usermod {
private:
static const char _name[];
unsigned long lastTime = 0;
char cronixieDisplay[7] = "HHMMSS";
byte _digitOut[6] = {10,10,10,10,10,10};
Expand Down Expand Up @@ -297,7 +298,13 @@ class UsermodCronixie : public Usermod {
{
return USERMOD_ID_CRONIXIE;
}

const char* getName() override {
return _name;
}
};

const char UsermodCronixie::_name[] PROGMEM = "Cronixie";

static UsermodCronixie cronixie;
REGISTER_USERMOD(cronixie);
7 changes: 7 additions & 0 deletions usermods/DHT/DHT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ DHT_nonblocking dht_sensor(DHTPIN, DHTTYPE);

class UsermodDHT : public Usermod {
private:
static const char _name[];
unsigned long nextReadTime = 0;
unsigned long lastReadTime = 0;
float humidity, temperature = 0;
Expand Down Expand Up @@ -242,8 +243,14 @@ class UsermodDHT : public Usermod {
return USERMOD_ID_DHT;
}

const char* getName() override {
return _name;
}

};


const char UsermodDHT::_name[] PROGMEM = "DHT";

static UsermodDHT dht;
REGISTER_USERMOD(dht);
8 changes: 8 additions & 0 deletions usermods/EXAMPLE/usermod_v2_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,14 @@ class MyExampleUsermod : public Usermod {
return USERMOD_ID_EXAMPLE;
}

/*
* getName() must return the _name string of the usermod.
*/
const char* getName() override
{
return _name;
}

//More methods can be added in the future, this example will then be extended.
//Your usermod will remain compatible as it does not need to implement all methods from the Usermod base class!
};
Expand Down
5 changes: 5 additions & 0 deletions usermods/EleksTube_IPS/EleksTube_IPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ class ElekstubeIPSUsermod : public Usermod {
{
return USERMOD_ID_ELEKSTUBE_IPS;
}

const char* getName() override
{
return _name;
}
};

// strings to reduce flash memory usage (used more than twice)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class FixUnreachableNetServices : public Usermod
{
private:
//Private class members. You can declare variables and functions only accessible to your usermod here
static const char _name[];
unsigned long m_lastTime = 0;

// declare required variables
Expand Down Expand Up @@ -159,7 +160,13 @@ Delay <input type=\"number\" min=\"5\" max=\"300\" value=\"";
{
return USERMOD_ID_FIXNETSERVICES;
}
};

const char* getName() override {
return _name;
}
};

const char FixUnreachableNetServices::_name[] PROGMEM = "Fix Unreachable Netservices";

static FixUnreachableNetServices fix_unreachable_net_services;
REGISTER_USERMOD(fix_unreachable_net_services);
Expand Down
5 changes: 5 additions & 0 deletions usermods/INA226_v2/INA226_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,11 @@ class UsermodINA226 : public Usermod
return USERMOD_ID_INA226;
}

const char* getName() override
{
return _name;
}

void addToJsonInfo(JsonObject &root) override
{
JsonObject user = root["u"];
Expand Down
5 changes: 5 additions & 0 deletions usermods/Internal_Temperature_v2/Internal_Temperature_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ class InternalTemperatureUsermod : public Usermod
{
return USERMOD_ID_INTERNAL_TEMPERATURE;
}

const char* getName() override
{
return _name;
}
};

const char InternalTemperatureUsermod::_name[] PROGMEM = "Internal Temperature";
Expand Down
5 changes: 5 additions & 0 deletions usermods/LD2410_v2/LD2410_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ class LD2410Usermod : public Usermod {
{
return USERMOD_ID_LD2410;
}

const char* getName() override
{
return _name;
}
};


Expand Down
5 changes: 5 additions & 0 deletions usermods/LDR_Dusk_Dawn_v2/LDR_Dusk_Dawn_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ class LDR_Dusk_Dawn_v2 : public Usermod {
uint16_t getId() {
return USERMOD_ID_LDR_DUSK_DAWN;
}

const char* getName() override
{
return _name;
}
};

const char LDR_Dusk_Dawn_v2::_name[] PROGMEM = "LDR_Dusk_Dawn_v2";
Expand Down
5 changes: 5 additions & 0 deletions usermods/MAX17048_v2/MAX17048_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,11 @@ class Usermod_MAX17048 : public Usermod {
return USERMOD_ID_MAX17048;
}

const char* getName() override
{
return _name;
}

};


Expand Down
7 changes: 7 additions & 0 deletions usermods/MY9291/MY9291.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

class MY9291Usermod : public Usermod {
private:
static const char _name[];
my92xx _my92xx = my92xx(MY92XX_MODEL, MY92XX_CHIPS, MY92XX_DI_PIN, MY92XX_DCKI_PIN, MY92XX_COMMAND_DEFAULT);

public:
Expand Down Expand Up @@ -40,7 +41,13 @@ class MY9291Usermod : public Usermod {
uint16_t getId() {
return USERMOD_ID_MY9291;
}

const char* getName() override {
return _name;
}
};

const char MY9291Usermod::_name[] PROGMEM = "MY9291";

static MY9291Usermod my9291;
REGISTER_USERMOD(my9291);
5 changes: 5 additions & 0 deletions usermods/PIR_sensor_switch/PIR_sensor_switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ class PIRsensorSwitch : public Usermod
* This could be used in the future for the system to determine whether your usermod is installed.
*/
uint16_t getId() override { return USERMOD_ID_PIRSWITCH; }

const char* getName() override
{
return _name;
}
};

// strings to reduce flash memory usage (used more than twice)
Expand Down
5 changes: 5 additions & 0 deletions usermods/PWM_fan/PWM_fan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ class PWMFanUsermod : public Usermod {
uint16_t getId() override {
return USERMOD_ID_PWM_FAN;
}

const char* getName() override
{
return _name;
}
};

// strings to reduce flash memory usage (used more than twice)
Expand Down
7 changes: 7 additions & 0 deletions usermods/RTC/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class RTCUsermod : public Usermod {
private:
static const char _name[];
unsigned long lastTime = 0;
bool disabled = false;
public:
Expand Down Expand Up @@ -46,7 +47,13 @@ class RTCUsermod : public Usermod {
{
return USERMOD_ID_RTC;
}

const char* getName() override {
return _name;
}
};

const char RTCUsermod::_name[] PROGMEM = "RTC";

static RTCUsermod rtc;
REGISTER_USERMOD(rtc);
5 changes: 5 additions & 0 deletions usermods/SN_Photoresistor/SN_Photoresistor.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class Usermod_SN_Photoresistor : public Usermod
return USERMOD_ID_SN_PHOTORESISTOR;
}

const char* getName()
{
return _name;
}

/**
* addToConfig() (called from set.cpp) stores persistent properties to cfg.json
*/
Expand Down
Loading