mirror of
https://github.com/wled/WLED.git
synced 2025-12-28 10:58:35 +00:00
Compare commits
1 Commits
copilot/ad
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c2cacf185 |
@@ -118,13 +118,7 @@ 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] = {
|
||||
@@ -258,7 +252,5 @@ class ADS1115Usermod : public Usermod {
|
||||
}
|
||||
};
|
||||
|
||||
const char ADS1115Usermod::_name[] PROGMEM = "ADS1115";
|
||||
|
||||
static ADS1115Usermod ads1115_v2;
|
||||
REGISTER_USERMOD(ads1115_v2);
|
||||
@@ -182,11 +182,6 @@ public:
|
||||
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
|
||||
|
||||
@@ -7,7 +7,6 @@ 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;
|
||||
|
||||
@@ -253,14 +252,8 @@ public:
|
||||
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);
|
||||
@@ -353,11 +353,6 @@ 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
|
||||
|
||||
@@ -89,9 +89,4 @@ public:
|
||||
return USERMOD_ID_BH1750;
|
||||
}
|
||||
|
||||
inline const char* getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -473,11 +473,6 @@ public:
|
||||
uint16_t getId() {
|
||||
return USERMOD_ID_BME280;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280";
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
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.
|
||||
@@ -75,7 +74,6 @@
|
||||
|
||||
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);
|
||||
@@ -866,15 +864,6 @@
|
||||
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
|
||||
@@ -1121,7 +1110,5 @@
|
||||
}
|
||||
|
||||
|
||||
const char UsermodBME68X::_name[] PROGMEM = "BME68X";
|
||||
|
||||
static UsermodBME68X bme68x_v2;
|
||||
REGISTER_USERMOD(bme68x_v2);
|
||||
@@ -604,11 +604,6 @@ class UsermodBattery : public Usermod
|
||||
return USERMOD_ID_BATTERY;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* get currently active battery type
|
||||
*/
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
class UsermodCronixie : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
unsigned long lastTime = 0;
|
||||
char cronixieDisplay[7] = "HHMMSS";
|
||||
byte _digitOut[6] = {10,10,10,10,10,10};
|
||||
byte dP[6] = {255, 255, 255, 255, 255, 255};
|
||||
@@ -298,13 +297,7 @@ unsigned long lastTime = 0;
|
||||
{
|
||||
return USERMOD_ID_CRONIXIE;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UsermodCronixie::_name[] PROGMEM = "Cronixie";
|
||||
|
||||
static UsermodCronixie cronixie;
|
||||
REGISTER_USERMOD(cronixie);
|
||||
@@ -59,7 +59,6 @@ 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;
|
||||
@@ -243,14 +242,8 @@ 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);
|
||||
@@ -378,14 +378,6 @@ 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!
|
||||
};
|
||||
|
||||
@@ -149,11 +149,6 @@ 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)
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
class FixUnreachableNetServices : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
unsigned long m_lastTime = 0;
|
||||
|
||||
// declare required variables
|
||||
@@ -160,13 +159,7 @@ 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);
|
||||
|
||||
@@ -359,11 +359,6 @@ public:
|
||||
return USERMOD_ID_INA226;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void addToJsonInfo(JsonObject &root) override
|
||||
{
|
||||
JsonObject user = root["u"];
|
||||
|
||||
@@ -171,11 +171,6 @@ public:
|
||||
{
|
||||
return USERMOD_ID_INTERNAL_TEMPERATURE;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char InternalTemperatureUsermod::_name[] PROGMEM = "Internal Temperature";
|
||||
|
||||
@@ -208,11 +208,6 @@ class LD2410Usermod : public Usermod {
|
||||
{
|
||||
return USERMOD_ID_LD2410;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -147,11 +147,6 @@ 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";
|
||||
|
||||
@@ -268,11 +268,6 @@ class Usermod_MAX17048 : public Usermod {
|
||||
return USERMOD_ID_MAX17048;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
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:
|
||||
@@ -41,13 +40,7 @@ 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);
|
||||
@@ -187,11 +187,6 @@ public:
|
||||
* 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)
|
||||
|
||||
@@ -387,11 +387,6 @@ 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)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
class RTCUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
bool disabled = false;
|
||||
public:
|
||||
@@ -47,13 +46,7 @@ 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);
|
||||
@@ -78,11 +78,6 @@ public:
|
||||
return USERMOD_ID_SN_PHOTORESISTOR;
|
||||
}
|
||||
|
||||
const char* getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* addToConfig() (called from set.cpp) stores persistent properties to cfg.json
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,6 @@ extern int getSignalQuality(int rssi);
|
||||
//class name. Use something descriptive and leave the ": public Usermod" part :)
|
||||
class St7789DisplayUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
unsigned long lastTime = 0;
|
||||
bool enabled = true;
|
||||
@@ -365,7 +364,7 @@ class St7789DisplayUsermod : public Usermod {
|
||||
*/
|
||||
void addToConfig(JsonObject& root) override
|
||||
{
|
||||
JsonObject top = root.createNestedObject(FPSTR(_name));
|
||||
JsonObject top = root.createNestedObject("ST7789");
|
||||
JsonArray pins = top.createNestedArray("pin");
|
||||
pins.add(TFT_CS);
|
||||
pins.add(TFT_DC);
|
||||
@@ -407,16 +406,9 @@ class St7789DisplayUsermod : public Usermod {
|
||||
return USERMOD_ID_ST7789_DISPLAY;
|
||||
}
|
||||
|
||||
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!
|
||||
};
|
||||
|
||||
const char St7789DisplayUsermod::_name[] PROGMEM = "ST7789";
|
||||
|
||||
static St7789DisplayUsermod st7789_display;
|
||||
static name. st7789_display;
|
||||
REGISTER_USERMOD(st7789_display);
|
||||
@@ -220,11 +220,6 @@ class Si7021_MQTT_HA : public Usermod
|
||||
{
|
||||
return USERMOD_ID_SI7021_MQTT_HA;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
// strings to reduce flash memory usage (used more than twice)
|
||||
|
||||
@@ -88,11 +88,6 @@ class UsermodTemperature : public Usermod {
|
||||
const char *getTemperatureUnit();
|
||||
uint16_t getId() override { return USERMOD_ID_TEMPERATURE; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
//void connected() override;
|
||||
|
||||
@@ -231,7 +231,6 @@ class TetrisAIUsermod : public Usermod
|
||||
{
|
||||
|
||||
private:
|
||||
static const char _name[];
|
||||
|
||||
public:
|
||||
void setup()
|
||||
@@ -248,15 +247,8 @@ public:
|
||||
{
|
||||
return USERMOD_ID_TETRISAI;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const char TetrisAIUsermod::_name[] PROGMEM = "Tetris AI";
|
||||
|
||||
static TetrisAIUsermod tetrisai_v2;
|
||||
REGISTER_USERMOD(tetrisai_v2);
|
||||
@@ -37,7 +37,6 @@
|
||||
class UsermodVL53L0XGestures : public Usermod {
|
||||
private:
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
VL53L0X sensor;
|
||||
bool enabled = true;
|
||||
@@ -125,13 +124,7 @@ class UsermodVL53L0XGestures : public Usermod {
|
||||
{
|
||||
return USERMOD_ID_VL53L0X;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UsermodVL53L0XGestures::_name[] PROGMEM = "VL53L0X Gestures";
|
||||
|
||||
static UsermodVL53L0XGestures vl53l0x_gestures;
|
||||
REGISTER_USERMOD(vl53l0x_gestures);
|
||||
@@ -1974,11 +1974,6 @@ class AudioReactive : public Usermod {
|
||||
{
|
||||
return USERMOD_ID_AUDIOREACTIVE;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
void AudioReactive::removeAudioPalettes(void) {
|
||||
|
||||
@@ -359,11 +359,6 @@ class BobLightUsermod : public Usermod {
|
||||
|
||||
uint16_t getId() override { return USERMOD_ID_BOBLIGHT; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// strings to reduce flash memory usage (used more than twice)
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
class BuzzerUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime_ = 0;
|
||||
unsigned long lastTime_ = 0;
|
||||
unsigned long delay_ = 0;
|
||||
std::deque<std::pair<uint8_t, unsigned long>> sequence_ {};
|
||||
public:
|
||||
@@ -78,13 +77,7 @@ unsigned long lastTime_ = 0;
|
||||
{
|
||||
return USERMOD_ID_BUZZER;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char BuzzerUsermod::_name[] PROGMEM = "Buzzer";
|
||||
|
||||
static BuzzerUsermod buzzer;
|
||||
REGISTER_USERMOD(buzzer);
|
||||
@@ -218,11 +218,6 @@ void addToConfig(JsonObject& root) override
|
||||
return USERMOD_ID_DEEP_SLEEP;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// add more strings here to reduce flash memory usage
|
||||
|
||||
@@ -432,11 +432,6 @@ class MPU6050Driver : public Usermod {
|
||||
return USERMOD_ID_IMU;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -214,10 +214,6 @@ class GyroSurge : public Usermod {
|
||||
// TODO - multiple segment handling??
|
||||
strip.getSegment(0).fadeToBlackBy(max - result);
|
||||
}
|
||||
|
||||
const char* getName() {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char GyroSurge::_name[] PROGMEM = "GyroSurge";
|
||||
@@ -146,11 +146,6 @@ class MultiRelay : public Usermod {
|
||||
*/
|
||||
inline uint16_t getId() override { return USERMOD_ID_MULTI_RELAY; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* switch relay on/off
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
class PixelsDiceTrayUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
bool enabled = true;
|
||||
|
||||
DiceUpdate dice_update;
|
||||
@@ -528,17 +527,11 @@ class PixelsDiceTrayUsermod : public Usermod {
|
||||
*/
|
||||
uint16_t getId() { return USERMOD_ID_PIXELS_DICE_TRAY; }
|
||||
|
||||
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!
|
||||
};
|
||||
|
||||
|
||||
const char PixelsDiceTrayUsermod::_name[] PROGMEM = "Pixels Dice Tray";
|
||||
|
||||
static PixelsDiceTrayUsermod pixels_dice_tray;
|
||||
REGISTER_USERMOD(pixels_dice_tray);
|
||||
@@ -69,11 +69,6 @@ public:
|
||||
uint16_t getId() override {
|
||||
return USERMOD_ID_POV_DISPLAY;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
static PovDisplayUsermod pov_display("POV Display", false);
|
||||
|
||||
@@ -211,10 +211,6 @@ class PwmOutputsUsermod : public Usermod {
|
||||
return USERMOD_ID_PWM_OUTPUTS;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return USERMOD_NAME;
|
||||
}
|
||||
|
||||
private:
|
||||
PwmOutput pwms_[USERMOD_PWM_OUTPUT_PINS];
|
||||
|
||||
@@ -223,5 +219,6 @@ class PwmOutputsUsermod : public Usermod {
|
||||
const char PwmOutputsUsermod::USERMOD_NAME[] PROGMEM = "PwmOutputs";
|
||||
const char PwmOutputsUsermod::PWM_STATE_NAME[] PROGMEM = "pwm";
|
||||
|
||||
|
||||
static PwmOutputsUsermod pwm_outputs;
|
||||
REGISTER_USERMOD(pwm_outputs);
|
||||
@@ -687,11 +687,6 @@ class QuinLEDAnPentaUsermod : public Usermod
|
||||
{
|
||||
return USERMOD_ID_QUINLED_AN_PENTA;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
// strings to reduce flash memory usage (used more than twice)
|
||||
|
||||
@@ -328,11 +328,6 @@ class RgbRotaryEncoderUsermod : public Usermod
|
||||
return USERMOD_RGB_ROTARY_ENCODER;
|
||||
}
|
||||
|
||||
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!
|
||||
};
|
||||
|
||||
@@ -132,11 +132,6 @@ class UsermodSdCard : public Usermod {
|
||||
return USERMOD_ID_SD_CARD;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void addToConfig(JsonObject& root)
|
||||
{
|
||||
#ifdef WLED_USE_SD_SPI
|
||||
|
||||
@@ -16,7 +16,6 @@ static Adafruit_CCS811 ccs811;
|
||||
class UserMod_SensorsToMQTT : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
bool initialized = false;
|
||||
bool mqttInitialized = false;
|
||||
float SensorPressure = 0;
|
||||
@@ -275,13 +274,8 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UserMod_SensorsToMQTT::_name[] PROGMEM = "Sensors to MQTT";
|
||||
|
||||
static UserMod_SensorsToMQTT sensors_to_mqtt;
|
||||
REGISTER_USERMOD(sensors_to_mqtt);
|
||||
@@ -10,8 +10,7 @@ class SevenSegmentDisplay : public Usermod
|
||||
#define WLED_SS_BUFFLEN 6
|
||||
#define REFRESHTIME 497
|
||||
private:
|
||||
static const char _name[];
|
||||
//Runtime variables.
|
||||
//Runtime variables.
|
||||
unsigned long lastRefresh = 0;
|
||||
unsigned long lastCharacterStep = 0;
|
||||
String ssDisplayBuffer = "";
|
||||
@@ -487,11 +486,7 @@ public:
|
||||
{
|
||||
return USERMOD_ID_SEVEN_SEGMENT_DISPLAY;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const char SevenSegmentDisplay::_str_perSegment[] PROGMEM = "perSegment";
|
||||
const char SevenSegmentDisplay::_str_perPeriod[] PROGMEM = "perPeriod";
|
||||
@@ -503,7 +498,5 @@ const char SevenSegmentDisplay::_str_displayMask[] PROGMEM = "displayMask";
|
||||
const char SevenSegmentDisplay::_str_displayMsg[] PROGMEM = "displayMsg";
|
||||
const char SevenSegmentDisplay::_str_sevenSeg[] PROGMEM = "sevenSeg";
|
||||
|
||||
const char SevenSegmentDisplay::_name[] PROGMEM = "Seven Segment Display";
|
||||
|
||||
static SevenSegmentDisplay seven_segment_display;
|
||||
REGISTER_USERMOD(seven_segment_display);
|
||||
@@ -579,10 +579,6 @@ public:
|
||||
uint16_t getId() {
|
||||
return USERMOD_ID_SSDR;
|
||||
}
|
||||
|
||||
const char* getName() {
|
||||
return _str_name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UsermodSSDR::_str_name[] PROGMEM = "UsermodSSDR";
|
||||
|
||||
@@ -68,9 +68,4 @@ class ShtUsermod : public Usermod
|
||||
const char* getUnitString();
|
||||
|
||||
uint16_t getId() { return USERMOD_ID_SHT; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
class Smartnest : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
bool initialized = false;
|
||||
unsigned long lastMqttReport = 0;
|
||||
unsigned long mqttReportInterval = 60000; // Report every minute
|
||||
@@ -172,10 +171,6 @@ public:
|
||||
return USERMOD_ID_SMARTNEST;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* setup() is called once at startup to initialize the usermod.
|
||||
*/
|
||||
@@ -208,7 +203,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
const char Smartnest::_name[] PROGMEM = "Smartnest";
|
||||
|
||||
static Smartnest smartnest;
|
||||
REGISTER_USERMOD(smartnest);
|
||||
@@ -13,8 +13,7 @@
|
||||
|
||||
class StairwayWipeUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
unsigned long lastTime = 0;
|
||||
byte wipeState = 0; //0: inactive 1: wiping 2: solid
|
||||
unsigned long timeStaticStart = 0;
|
||||
@@ -90,10 +89,6 @@ void setup() {
|
||||
return USERMOD_ID_STAIRWAY_WIPE;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
void startWipe()
|
||||
{
|
||||
@@ -133,7 +128,5 @@ void setup() {
|
||||
};
|
||||
|
||||
|
||||
const char StairwayWipeUsermod::_name[] PROGMEM = "Stairway Wipe";
|
||||
|
||||
static StairwayWipeUsermod stairway_wipe_basic;
|
||||
REGISTER_USERMOD(stairway_wipe_basic);
|
||||
@@ -79,13 +79,7 @@ class UdpNameSync : public Usermod {
|
||||
DEBUG_PRINT(F("UdpNameSync: set segment name"));
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UdpNameSync::_name[] PROGMEM = "UDP Name Sync";
|
||||
|
||||
static UdpNameSync udp_name_sync;
|
||||
REGISTER_USERMOD(udp_name_sync);
|
||||
|
||||
@@ -95,7 +95,6 @@ static const char _data_FX_MODE_DIFFUSIONFIRE[] PROGMEM = "Diffusion Fire@!,Spar
|
||||
|
||||
class UserFxUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
public:
|
||||
void setup() override {
|
||||
strip.addEffect(255, &mode_diffusionfire, _data_FX_MODE_DIFFUSIONFIRE);
|
||||
@@ -112,13 +111,7 @@ class UserFxUsermod : public Usermod {
|
||||
}
|
||||
void loop() override {} // nothing to do in the loop
|
||||
uint16_t getId() override { return USERMOD_ID_USER_FX; }
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UserFxUsermod::_name[] PROGMEM = "User FX";
|
||||
};
|
||||
|
||||
static UserFxUsermod user_fx;
|
||||
REGISTER_USERMOD(user_fx);
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
class RotaryEncoderBrightnessColor : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
//Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
unsigned long lastTime = 0;
|
||||
unsigned long currentTime;
|
||||
unsigned long loopTime;
|
||||
@@ -185,14 +184,8 @@ public:
|
||||
|
||||
return configComplete;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const char RotaryEncoderBrightnessColor::_name[] PROGMEM = "Rotary Brightness Color";
|
||||
|
||||
static RotaryEncoderBrightnessColor usermod_rotary_brightness_color;
|
||||
REGISTER_USERMOD(usermod_rotary_brightness_color);
|
||||
@@ -86,11 +86,6 @@ public:
|
||||
bool readFromConfig(JsonObject& root);
|
||||
void addToConfig(JsonObject& root);
|
||||
uint16_t getId() { return USERMOD_ID_HTTP_PULL_LIGHT_CONTROL; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
inline void enable(bool enable) { enabled = enable; } // Enable or Disable the usermod
|
||||
inline bool isEnabled() { return enabled; } // Get usermod enabled or disabled state
|
||||
virtual ~HttpPullLightControl() {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class RF433Usermod : public Usermod
|
||||
{
|
||||
private:
|
||||
RCSwitch mySwitch = RCSwitch();
|
||||
RCSwitch mySwitch = RCSwitch();
|
||||
unsigned long lastCommand = 0;
|
||||
unsigned long lastTime = 0;
|
||||
|
||||
@@ -118,10 +118,6 @@ public:
|
||||
return USERMOD_ID_RF433;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _modName;
|
||||
}
|
||||
|
||||
// this function follows the same principle as decodeIRJson() / remoteJson()
|
||||
bool remoteJson433(int button)
|
||||
{
|
||||
|
||||
@@ -448,11 +448,6 @@ class AnimartrixUsermod : public Usermod {
|
||||
return USERMOD_ID_ANIMARTRIX;
|
||||
}
|
||||
|
||||
const char* getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static AnimartrixUsermod animartrix_module("Animartrix", false);
|
||||
|
||||
@@ -265,11 +265,6 @@ class AutoSaveUsermod : public Usermod {
|
||||
uint16_t getId() {
|
||||
return USERMOD_ID_AUTO_SAVE;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
// strings to reduce flash memory usage (used more than twice)
|
||||
|
||||
@@ -39,11 +39,6 @@ public:
|
||||
return USERMOD_ID_BRIGHTNESS_FOLLOW_SUN;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
if (sunrise == 0 || sunset == 0 || localTime == 0)
|
||||
|
||||
@@ -311,9 +311,5 @@ class FourLineDisplayUsermod : public Usermod {
|
||||
uint16_t getId() override {
|
||||
return USERMOD_ID_FOUR_LINE_DISP;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -215,11 +215,6 @@ public:
|
||||
{
|
||||
return USERMOD_ID_KLIPPER;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
const char klipper_percentage::_name[] PROGMEM = "Klipper_Percentage";
|
||||
const char klipper_percentage::_enabled[] PROGMEM = "enabled";
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
class PingPongClockUsermod : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
// Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
// Private class members. You can declare variables and functions only accessible to your usermod here
|
||||
unsigned long lastTime = 0;
|
||||
bool colonOn = true;
|
||||
|
||||
@@ -115,14 +114,8 @@ public:
|
||||
return USERMOD_ID_PING_PONG_CLOCK;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
const char PingPongClockUsermod::_name[] PROGMEM = "Ping Pong Clock";
|
||||
|
||||
static PingPongClockUsermod usermod_v2_ping_pong_clock;
|
||||
REGISTER_USERMOD(usermod_v2_ping_pong_clock);
|
||||
@@ -288,11 +288,6 @@ class RotaryEncoderUIUsermod : 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_ROTARY_ENC_UI; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
/**
|
||||
* Enable/Disable the usermod
|
||||
*/
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
class WordClockUsermod : public Usermod
|
||||
{
|
||||
private:
|
||||
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
int lastTimeMinutes = -1;
|
||||
|
||||
@@ -502,15 +500,9 @@ class WordClockUsermod : public Usermod
|
||||
return USERMOD_ID_WORDCLOCK;
|
||||
}
|
||||
|
||||
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!
|
||||
};
|
||||
|
||||
const char WordClockUsermod::_name[] PROGMEM = "Word Clock";
|
||||
|
||||
static WordClockUsermod usermod_v2_word_clock;
|
||||
REGISTER_USERMOD(usermod_v2_word_clock);
|
||||
@@ -111,12 +111,7 @@ class WireguardUsermod : public Usermod {
|
||||
|
||||
uint16_t getId() { return USERMOD_ID_WIREGUARD; }
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
private:
|
||||
static const char _name[];
|
||||
WireGuard wg;
|
||||
char preshared_key[45];
|
||||
char private_key[45];
|
||||
@@ -129,7 +124,5 @@ class WireguardUsermod : public Usermod {
|
||||
unsigned long lastTime = 0;
|
||||
};
|
||||
|
||||
const char WireguardUsermod::_name[] PROGMEM = "Wireguard";
|
||||
|
||||
static WireguardUsermod wireguard;
|
||||
REGISTER_USERMOD(wireguard);
|
||||
@@ -12,7 +12,6 @@ WiFiUDP UDP;
|
||||
class WizLightsUsermod : public Usermod {
|
||||
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
long updateInterval;
|
||||
long sendDelay;
|
||||
@@ -154,14 +153,8 @@ class WizLightsUsermod : public Usermod {
|
||||
String getJsonLabel(uint8_t i) {return "WiZ Light IP #" + String(i+1);}
|
||||
|
||||
uint16_t getId(){return USERMOD_ID_WIZLIGHTS;}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const char WizLightsUsermod::_name[] PROGMEM = "Wiz Lights";
|
||||
|
||||
static WizLightsUsermod wizlights;
|
||||
REGISTER_USERMOD(wizlights);
|
||||
@@ -10,7 +10,6 @@
|
||||
class WordClockMatrix : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
uint8_t minuteLast = 99;
|
||||
int dayBrightness = 128;
|
||||
@@ -333,15 +332,9 @@ public:
|
||||
return 500;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
const char WordClockMatrix::_name[] PROGMEM = "Word Clock Matrix";
|
||||
|
||||
static WordClockMatrix word_clock_matrix;
|
||||
REGISTER_USERMOD(word_clock_matrix);
|
||||
@@ -397,11 +397,19 @@ button, .btn {
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="ed active">
|
||||
<div>
|
||||
<h3>Video Lab</h3>
|
||||
<div><small>Stream video and generate animated GIFs (beta)</small></div>
|
||||
<button class="btn" id="t2" style="display:none"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="ed active">
|
||||
<div>
|
||||
<h3>PIXEL MAGIC Tool</h3>
|
||||
<div><small>Legacy pixel art editor</small></div>
|
||||
<button class="btn" id="t2" style="display:none"></button>
|
||||
<button class="btn" id="t3" style="display:none"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
@@ -439,7 +447,8 @@ let fL; // file list
|
||||
await segLoad(); // load available segments
|
||||
await flU(); // update file list
|
||||
toolChk('pixelpaint.htm','t1'); // update buttons of additional tools
|
||||
toolChk('pxmagic.htm','t2');
|
||||
toolChk('videolab.htm','t2');
|
||||
toolChk('pxmagic.htm','t3');
|
||||
await fsMem(); // show file system memory info
|
||||
})();
|
||||
|
||||
|
||||
@@ -321,7 +321,6 @@ class Usermod {
|
||||
virtual void onUpdateBegin(bool) {} // fired prior to and after unsuccessful firmware update
|
||||
virtual void onStateChange(uint8_t mode) {} // fired upon WLED state change
|
||||
virtual uint16_t getId() {return USERMOD_ID_UNSPECIFIED;}
|
||||
virtual const char* getName() { return nullptr; } // get usermod name
|
||||
|
||||
// API shims
|
||||
private:
|
||||
@@ -362,7 +361,6 @@ namespace UsermodManager {
|
||||
void onUpdateBegin(bool);
|
||||
void onStateChange(uint8_t);
|
||||
Usermod* lookup(uint16_t mod_id);
|
||||
const char* getName(uint16_t mod_id);
|
||||
size_t getModCount();
|
||||
};
|
||||
|
||||
|
||||
@@ -87,17 +87,6 @@ Usermod* UsermodManager::lookup(uint16_t mod_id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get usermod name by ID.
|
||||
*/
|
||||
const char* UsermodManager::getName(uint16_t mod_id) {
|
||||
Usermod* mod = lookup(mod_id);
|
||||
if (mod != nullptr) {
|
||||
return mod->getName();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t UsermodManager::getModCount() { return getCount(); };
|
||||
|
||||
/* Usermod v2 interface shim for oappend */
|
||||
|
||||
Reference in New Issue
Block a user