mirror of
https://github.com/wled/WLED.git
synced 2025-12-28 19:08:00 +00:00
Compare commits
13 Commits
main
...
copilot/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9518f4a04 | ||
|
|
4ebdb0c0c1 | ||
|
|
f1ea13e553 | ||
|
|
b2aedd180a | ||
|
|
f56c082972 | ||
|
|
423d319f88 | ||
|
|
897ce57b2d | ||
|
|
60dce26a6a | ||
|
|
20b388fd60 | ||
|
|
0a2de0c642 | ||
|
|
39f03cab7c | ||
|
|
6ee9524cab | ||
|
|
52fb5b4faa |
@@ -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] = {
|
||||
@@ -252,5 +258,7 @@ class ADS1115Usermod : public Usermod {
|
||||
}
|
||||
};
|
||||
|
||||
const char ADS1115Usermod::_name[] PROGMEM = "ADS1115";
|
||||
|
||||
static ADS1115Usermod ads1115_v2;
|
||||
REGISTER_USERMOD(ads1115_v2);
|
||||
@@ -182,6 +182,11 @@ 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,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;
|
||||
|
||||
@@ -252,8 +253,14 @@ 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,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
|
||||
|
||||
@@ -89,4 +89,9 @@ public:
|
||||
return USERMOD_ID_BH1750;
|
||||
}
|
||||
|
||||
inline const char* getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -473,6 +473,11 @@ public:
|
||||
uint16_t getId() {
|
||||
return USERMOD_ID_BME280;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280";
|
||||
|
||||
@@ -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.
|
||||
@@ -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);
|
||||
@@ -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
|
||||
@@ -1110,5 +1121,7 @@
|
||||
}
|
||||
|
||||
|
||||
const char UsermodBME68X::_name[] PROGMEM = "BME68X";
|
||||
|
||||
static UsermodBME68X bme68x_v2;
|
||||
REGISTER_USERMOD(bme68x_v2);
|
||||
@@ -604,6 +604,11 @@ class UsermodBattery : public Usermod
|
||||
return USERMOD_ID_BATTERY;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* get currently active battery type
|
||||
*/
|
||||
|
||||
@@ -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};
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
@@ -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!
|
||||
};
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -359,6 +359,11 @@ public:
|
||||
return USERMOD_ID_INA226;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void addToJsonInfo(JsonObject &root) override
|
||||
{
|
||||
JsonObject user = root["u"];
|
||||
|
||||
@@ -171,6 +171,11 @@ public:
|
||||
{
|
||||
return USERMOD_ID_INTERNAL_TEMPERATURE;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char InternalTemperatureUsermod::_name[] PROGMEM = "Internal Temperature";
|
||||
|
||||
@@ -208,6 +208,11 @@ class LD2410Usermod : public Usermod {
|
||||
{
|
||||
return USERMOD_ID_LD2410;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -268,6 +268,11 @@ class Usermod_MAX17048 : public Usermod {
|
||||
return USERMOD_ID_MAX17048;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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:
|
||||
@@ -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);
|
||||
@@ -187,6 +187,11 @@ 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,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)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
class RTCUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
bool disabled = false;
|
||||
public:
|
||||
@@ -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);
|
||||
@@ -78,6 +78,11 @@ public:
|
||||
return USERMOD_ID_SN_PHOTORESISTOR;
|
||||
}
|
||||
|
||||
const char* getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* addToConfig() (called from set.cpp) stores persistent properties to cfg.json
|
||||
*/
|
||||
|
||||
@@ -48,6 +48,7 @@ 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;
|
||||
@@ -364,7 +365,7 @@ class St7789DisplayUsermod : public Usermod {
|
||||
*/
|
||||
void addToConfig(JsonObject& root) override
|
||||
{
|
||||
JsonObject top = root.createNestedObject("ST7789");
|
||||
JsonObject top = root.createNestedObject(FPSTR(_name));
|
||||
JsonArray pins = top.createNestedArray("pin");
|
||||
pins.add(TFT_CS);
|
||||
pins.add(TFT_DC);
|
||||
@@ -406,9 +407,16 @@ 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!
|
||||
};
|
||||
|
||||
static name. st7789_display;
|
||||
const char St7789DisplayUsermod::_name[] PROGMEM = "ST7789";
|
||||
|
||||
static St7789DisplayUsermod st7789_display;
|
||||
REGISTER_USERMOD(st7789_display);
|
||||
@@ -220,6 +220,11 @@ 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,6 +88,11 @@ 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,6 +231,7 @@ class TetrisAIUsermod : public Usermod
|
||||
{
|
||||
|
||||
private:
|
||||
static const char _name[];
|
||||
|
||||
public:
|
||||
void setup()
|
||||
@@ -247,8 +248,15 @@ 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,6 +37,7 @@
|
||||
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;
|
||||
@@ -124,7 +125,13 @@ 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,6 +1974,11 @@ class AudioReactive : public Usermod {
|
||||
{
|
||||
return USERMOD_ID_AUDIOREACTIVE;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
void AudioReactive::removeAudioPalettes(void) {
|
||||
|
||||
@@ -359,6 +359,11 @@ 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,6 +20,7 @@
|
||||
|
||||
class BuzzerUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime_ = 0;
|
||||
unsigned long delay_ = 0;
|
||||
std::deque<std::pair<uint8_t, unsigned long>> sequence_ {};
|
||||
@@ -77,7 +78,13 @@ class BuzzerUsermod : public Usermod {
|
||||
{
|
||||
return USERMOD_ID_BUZZER;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char BuzzerUsermod::_name[] PROGMEM = "Buzzer";
|
||||
|
||||
static BuzzerUsermod buzzer;
|
||||
REGISTER_USERMOD(buzzer);
|
||||
@@ -218,6 +218,11 @@ 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,6 +432,11 @@ class MPU6050Driver : public Usermod {
|
||||
return USERMOD_ID_IMU;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -214,6 +214,10 @@ 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,6 +146,11 @@ 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,6 +39,7 @@
|
||||
|
||||
class PixelsDiceTrayUsermod : public Usermod {
|
||||
private:
|
||||
static const char _name[];
|
||||
bool enabled = true;
|
||||
|
||||
DiceUpdate dice_update;
|
||||
@@ -527,11 +528,17 @@ 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,6 +69,11 @@ public:
|
||||
uint16_t getId() override {
|
||||
return USERMOD_ID_POV_DISPLAY;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
static PovDisplayUsermod pov_display("POV Display", false);
|
||||
|
||||
@@ -211,6 +211,10 @@ class PwmOutputsUsermod : public Usermod {
|
||||
return USERMOD_ID_PWM_OUTPUTS;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return USERMOD_NAME;
|
||||
}
|
||||
|
||||
private:
|
||||
PwmOutput pwms_[USERMOD_PWM_OUTPUT_PINS];
|
||||
|
||||
@@ -219,6 +223,5 @@ 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,6 +687,11 @@ 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,6 +328,11 @@ 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,6 +132,11 @@ 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,6 +16,7 @@ static Adafruit_CCS811 ccs811;
|
||||
class UserMod_SensorsToMQTT : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
bool initialized = false;
|
||||
bool mqttInitialized = false;
|
||||
float SensorPressure = 0;
|
||||
@@ -274,8 +275,13 @@ 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);
|
||||
@@ -11,6 +11,7 @@ class SevenSegmentDisplay : public Usermod
|
||||
#define REFRESHTIME 497
|
||||
private:
|
||||
//Runtime variables.
|
||||
static const char _name[];
|
||||
unsigned long lastRefresh = 0;
|
||||
unsigned long lastCharacterStep = 0;
|
||||
String ssDisplayBuffer = "";
|
||||
@@ -486,6 +487,10 @@ public:
|
||||
{
|
||||
return USERMOD_ID_SEVEN_SEGMENT_DISPLAY;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
const char SevenSegmentDisplay::_str_perSegment[] PROGMEM = "perSegment";
|
||||
@@ -498,5 +503,7 @@ 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,6 +579,10 @@ public:
|
||||
uint16_t getId() {
|
||||
return USERMOD_ID_SSDR;
|
||||
}
|
||||
|
||||
const char* getName() {
|
||||
return _str_name;
|
||||
}
|
||||
};
|
||||
|
||||
const char UsermodSSDR::_str_name[] PROGMEM = "UsermodSSDR";
|
||||
|
||||
@@ -68,4 +68,9 @@ class ShtUsermod : public Usermod
|
||||
const char* getUnitString();
|
||||
|
||||
uint16_t getId() { return USERMOD_ID_SHT; }
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
class Smartnest : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
bool initialized = false;
|
||||
unsigned long lastMqttReport = 0;
|
||||
unsigned long mqttReportInterval = 60000; // Report every minute
|
||||
@@ -171,6 +172,10 @@ public:
|
||||
return USERMOD_ID_SMARTNEST;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* setup() is called once at startup to initialize the usermod.
|
||||
*/
|
||||
@@ -203,5 +208,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
const char Smartnest::_name[] PROGMEM = "Smartnest";
|
||||
|
||||
static Smartnest smartnest;
|
||||
REGISTER_USERMOD(smartnest);
|
||||
@@ -14,6 +14,7 @@
|
||||
class StairwayWipeUsermod : 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;
|
||||
byte wipeState = 0; //0: inactive 1: wiping 2: solid
|
||||
unsigned long timeStaticStart = 0;
|
||||
@@ -89,6 +90,10 @@ void setup() {
|
||||
return USERMOD_ID_STAIRWAY_WIPE;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
|
||||
|
||||
void startWipe()
|
||||
{
|
||||
@@ -128,5 +133,7 @@ void setup() {
|
||||
};
|
||||
|
||||
|
||||
const char StairwayWipeUsermod::_name[] PROGMEM = "Stairway Wipe";
|
||||
|
||||
static StairwayWipeUsermod stairway_wipe_basic;
|
||||
REGISTER_USERMOD(stairway_wipe_basic);
|
||||
@@ -79,7 +79,13 @@ 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,6 +95,7 @@ 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);
|
||||
@@ -111,7 +112,13 @@ 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);
|
||||
|
||||
@@ -6,6 +6,7 @@ class RotaryEncoderBrightnessColor : 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;
|
||||
unsigned long currentTime;
|
||||
unsigned long loopTime;
|
||||
@@ -184,8 +185,14 @@ 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,6 +86,11 @@ 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() {
|
||||
|
||||
@@ -118,6 +118,10 @@ 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,6 +448,11 @@ class AnimartrixUsermod : public Usermod {
|
||||
return USERMOD_ID_ANIMARTRIX;
|
||||
}
|
||||
|
||||
const char* getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static AnimartrixUsermod animartrix_module("Animartrix", false);
|
||||
|
||||
@@ -265,6 +265,11 @@ 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,6 +39,11 @@ public:
|
||||
return USERMOD_ID_BRIGHTNESS_FOLLOW_SUN;
|
||||
}
|
||||
|
||||
const char* getName() override
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
if (sunrise == 0 || sunset == 0 || localTime == 0)
|
||||
|
||||
@@ -311,5 +311,9 @@ class FourLineDisplayUsermod : public Usermod {
|
||||
uint16_t getId() override {
|
||||
return USERMOD_ID_FOUR_LINE_DISP;
|
||||
}
|
||||
|
||||
const char* getName() override {
|
||||
return _name;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -215,6 +215,11 @@ 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";
|
||||
|
||||
@@ -4,6 +4,7 @@ class PingPongClockUsermod : 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;
|
||||
bool colonOn = true;
|
||||
|
||||
@@ -114,8 +115,14 @@ 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,6 +288,11 @@ 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,6 +15,7 @@
|
||||
class WordClockUsermod : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
int lastTimeMinutes = -1;
|
||||
|
||||
@@ -500,9 +501,15 @@ 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,7 +111,12 @@ 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];
|
||||
@@ -124,5 +129,7 @@ class WireguardUsermod : public Usermod {
|
||||
unsigned long lastTime = 0;
|
||||
};
|
||||
|
||||
const char WireguardUsermod::_name[] PROGMEM = "Wireguard";
|
||||
|
||||
static WireguardUsermod wireguard;
|
||||
REGISTER_USERMOD(wireguard);
|
||||
@@ -12,6 +12,7 @@ WiFiUDP UDP;
|
||||
class WizLightsUsermod : public Usermod {
|
||||
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
long updateInterval;
|
||||
long sendDelay;
|
||||
@@ -153,8 +154,14 @@ 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,6 +10,7 @@
|
||||
class WordClockMatrix : public Usermod
|
||||
{
|
||||
private:
|
||||
static const char _name[];
|
||||
unsigned long lastTime = 0;
|
||||
uint8_t minuteLast = 99;
|
||||
int dayBrightness = 128;
|
||||
@@ -332,9 +333,15 @@ 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,19 +397,11 @@ 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="t3" style="display:none"></button>
|
||||
<button class="btn" id="t2" style="display:none"></button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
@@ -447,8 +439,7 @@ let fL; // file list
|
||||
await segLoad(); // load available segments
|
||||
await flU(); // update file list
|
||||
toolChk('pixelpaint.htm','t1'); // update buttons of additional tools
|
||||
toolChk('videolab.htm','t2');
|
||||
toolChk('pxmagic.htm','t3');
|
||||
toolChk('pxmagic.htm','t2');
|
||||
await fsMem(); // show file system memory info
|
||||
})();
|
||||
|
||||
|
||||
@@ -321,6 +321,7 @@ 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:
|
||||
@@ -361,6 +362,7 @@ 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,6 +87,17 @@ 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