Merge branch 'master' into dev
This commit is contained in:
commit
2424df0d18
14
CHANGELOG.md
14
CHANGELOG.md
@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
### Builds after release 0.12.0
|
### Builds after release 0.12.0
|
||||||
|
|
||||||
|
#### Build 2106250
|
||||||
|
|
||||||
|
- Fixed preset only disabling on second effect/color change
|
||||||
|
|
||||||
|
#### Build 2106241
|
||||||
|
|
||||||
|
- BREAKING: Added ability for usermods to force a config save if config incomplete. `readFromConfig()` needs to return a `bool` to indicate if the config is complete
|
||||||
|
- Updated usermods implementing `readFromConfig()`
|
||||||
|
- Auto-create segments based on configured busses
|
||||||
|
|
||||||
|
#### Build 2106200
|
||||||
|
|
||||||
|
- Added 2 Ethernet boards and split Ethernet configs into separate file
|
||||||
|
|
||||||
#### Build 2106180
|
#### Build 2106180
|
||||||
|
|
||||||
- Fixed DOS on Chrome tab restore causing reboot
|
- Fixed DOS on Chrome tab restore causing reboot
|
||||||
|
6
tools/WLED_ESP32_16MB.csv
Normal file
6
tools/WLED_ESP32_16MB.csv
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
|
app0, app, ota_0, 0x10000, 0x200000,
|
||||||
|
app1, app, ota_1, 0x210000,0x200000,
|
||||||
|
spiffs, data, spiffs, 0x410000,0xBE0000,
|
|
@ -427,7 +427,7 @@ class Animated_Staircase : public Usermod {
|
|||||||
/*
|
/*
|
||||||
* Reads the configuration to internal flash memory before setup() is called.
|
* Reads the configuration to internal flash memory before setup() is called.
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject& root) {
|
bool readFromConfig(JsonObject& root) {
|
||||||
bool oldUseUSSensorTop = useUSSensorTop;
|
bool oldUseUSSensorTop = useUSSensorTop;
|
||||||
bool oldUseUSSensorBottom = useUSSensorBottom;
|
bool oldUseUSSensorBottom = useUSSensorBottom;
|
||||||
int8_t oldTopAPin = topPIRorTriggerPin;
|
int8_t oldTopAPin = topPIRorTriggerPin;
|
||||||
@ -435,6 +435,8 @@ class Animated_Staircase : public Usermod {
|
|||||||
int8_t oldBottomAPin = bottomPIRorTriggerPin;
|
int8_t oldBottomAPin = bottomPIRorTriggerPin;
|
||||||
int8_t oldBottomBPin = bottomEchoPin;
|
int8_t oldBottomBPin = bottomEchoPin;
|
||||||
|
|
||||||
|
bool configComplete = true;
|
||||||
|
|
||||||
JsonObject staircase = root[FPSTR(_name)];
|
JsonObject staircase = root[FPSTR(_name)];
|
||||||
if (!staircase.isNull()) {
|
if (!staircase.isNull()) {
|
||||||
if (staircase[FPSTR(_enabled)].is<bool>()) {
|
if (staircase[FPSTR(_enabled)].is<bool>()) {
|
||||||
@ -468,6 +470,7 @@ class Animated_Staircase : public Usermod {
|
|||||||
bottomMaxDist = min(150,max(30,staircase[FPSTR(_bottomEchoCm)].as<int>())); // max distance ~1.5m (a lag of 9ms may be expected)
|
bottomMaxDist = min(150,max(30,staircase[FPSTR(_bottomEchoCm)].as<int>())); // max distance ~1.5m (a lag of 9ms may be expected)
|
||||||
} else {
|
} else {
|
||||||
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
||||||
|
configComplete = false;
|
||||||
}
|
}
|
||||||
if (!initDone) {
|
if (!initDone) {
|
||||||
// first run: reading from cfg.json
|
// first run: reading from cfg.json
|
||||||
@ -490,6 +493,7 @@ class Animated_Staircase : public Usermod {
|
|||||||
}
|
}
|
||||||
if (changed) setup();
|
if (changed) setup();
|
||||||
}
|
}
|
||||||
|
return configComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -133,11 +133,28 @@ class MyExampleUsermod : public Usermod {
|
|||||||
* readFromConfig() is called BEFORE setup(). This means you can use your persistent values in setup() (e.g. pin assignments, buffer sizes),
|
* readFromConfig() is called BEFORE setup(). This means you can use your persistent values in setup() (e.g. pin assignments, buffer sizes),
|
||||||
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
|
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
|
||||||
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
|
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
|
||||||
|
*
|
||||||
|
* Return true in case your config was complete, or false if you'd like WLED to save your defaults to disk
|
||||||
|
*
|
||||||
|
* This function is guaranteed to be called on boot, but could also be called every time settings are updated
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject& root)
|
bool readFromConfig(JsonObject& root)
|
||||||
{
|
{
|
||||||
JsonObject top = root["top"];
|
userVar0 = 42; //set your variables to their boot default value (this can also be done when declaring the variable)
|
||||||
userVar0 = top["great"] | 42; //The value right of the pipe "|" is the default value in case your setting was not present in cfg.json (e.g. first boot)
|
|
||||||
|
JsonObject top = root["exampleUsermod"];
|
||||||
|
if (!top.isNull()) {
|
||||||
|
bool configComplete = true;
|
||||||
|
|
||||||
|
//check if value is there
|
||||||
|
if (top.containsKey("great")) {
|
||||||
|
//convert value to the correct type
|
||||||
|
userVar0 = top["great"].as<int>();
|
||||||
|
} else configComplete = false;
|
||||||
|
|
||||||
|
if (configComplete) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,11 +149,13 @@ Delay <input type=\"number\" min=\"5\" max=\"300\" value=\"";
|
|||||||
/**
|
/**
|
||||||
* restore the changeable values
|
* restore the changeable values
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject &root)
|
bool readFromConfig(JsonObject &root)
|
||||||
{
|
{
|
||||||
JsonObject top = root["FixUnreachableNetServices"];
|
JsonObject top = root["FixUnreachableNetServices"];
|
||||||
|
if (top.isNull()) return false;
|
||||||
m_pingDelayMs = top["PingDelayMs"] | m_pingDelayMs;
|
m_pingDelayMs = top["PingDelayMs"] | m_pingDelayMs;
|
||||||
m_pingDelayMs = max(5000UL, min(18000000UL, m_pingDelayMs));
|
m_pingDelayMs = max(5000UL, min(18000000UL, m_pingDelayMs));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -320,13 +320,13 @@ public:
|
|||||||
* restore the changeable values
|
* restore the changeable values
|
||||||
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject &root)
|
bool readFromConfig(JsonObject &root)
|
||||||
{
|
{
|
||||||
bool oldEnabled = enabled;
|
bool oldEnabled = enabled;
|
||||||
int8_t oldPin = PIRsensorPin;
|
int8_t oldPin = PIRsensorPin;
|
||||||
|
|
||||||
JsonObject top = root[FPSTR(_name)];
|
JsonObject top = root[FPSTR(_name)];
|
||||||
if (top.isNull()) return;
|
if (top.isNull()) return false;
|
||||||
|
|
||||||
if (top["pin"] != nullptr) {
|
if (top["pin"] != nullptr) {
|
||||||
PIRsensorPin = min(39,max(-1,top["pin"].as<int>())); // check bounds
|
PIRsensorPin = min(39,max(-1,top["pin"].as<int>())); // check bounds
|
||||||
@ -398,6 +398,8 @@ public:
|
|||||||
DEBUG_PRINTLN(F("PIR config (re)loaded."));
|
DEBUG_PRINTLN(F("PIR config (re)loaded."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +169,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject &root)
|
bool readFromConfig(JsonObject &root)
|
||||||
{
|
{
|
||||||
// we look for JSON object.
|
// we look for JSON object.
|
||||||
JsonObject top = root[FPSTR(_name)];
|
JsonObject top = root[FPSTR(_name)];
|
||||||
@ -196,7 +196,9 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -234,12 +234,13 @@ class UsermodTemperature : public Usermod {
|
|||||||
/**
|
/**
|
||||||
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject &root) {
|
bool readFromConfig(JsonObject &root) {
|
||||||
// we look for JSON object: {"Temperature": {"pin": 0, "degC": true}}
|
// we look for JSON object: {"Temperature": {"pin": 0, "degC": true}}
|
||||||
JsonObject top = root[FPSTR(_name)];
|
JsonObject top = root[FPSTR(_name)];
|
||||||
int8_t newTemperaturePin = temperaturePin;
|
int8_t newTemperaturePin = temperaturePin;
|
||||||
if (top.isNull()) return;
|
if (top.isNull()) return true;
|
||||||
|
|
||||||
|
bool configComplete = true;
|
||||||
if (top["pin"] != nullptr) {
|
if (top["pin"] != nullptr) {
|
||||||
if (top[FPSTR(_enabled)].is<bool>()) {
|
if (top[FPSTR(_enabled)].is<bool>()) {
|
||||||
disabled = !top[FPSTR(_enabled)].as<bool>();
|
disabled = !top[FPSTR(_enabled)].as<bool>();
|
||||||
@ -282,6 +283,7 @@ class UsermodTemperature : public Usermod {
|
|||||||
DEBUG_PRINTLN(F("Temperature config loaded."));
|
DEBUG_PRINTLN(F("Temperature config loaded."));
|
||||||
} else {
|
} else {
|
||||||
DEBUG_PRINTLN(F("Temperature config re-loaded."));
|
DEBUG_PRINTLN(F("Temperature config re-loaded."));
|
||||||
|
configComplete = false;
|
||||||
// changing paramters from settings page
|
// changing paramters from settings page
|
||||||
if (newTemperaturePin != temperaturePin) {
|
if (newTemperaturePin != temperaturePin) {
|
||||||
// deallocate pin and release memory
|
// deallocate pin and release memory
|
||||||
@ -292,6 +294,7 @@ class UsermodTemperature : public Usermod {
|
|||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return configComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t getId()
|
uint16_t getId()
|
||||||
|
@ -348,11 +348,11 @@ class MultiRelay : public Usermod {
|
|||||||
* restore the changeable values
|
* restore the changeable values
|
||||||
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
* readFromConfig() is called before setup() to populate properties from values stored in cfg.json
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject &root) {
|
bool readFromConfig(JsonObject &root) {
|
||||||
int8_t oldPin[MULTI_RELAY_MAX_RELAYS];
|
int8_t oldPin[MULTI_RELAY_MAX_RELAYS];
|
||||||
|
|
||||||
JsonObject top = root[FPSTR(_name)];
|
JsonObject top = root[FPSTR(_name)];
|
||||||
if (top.isNull()) return;
|
if (top.isNull()) return false;
|
||||||
|
|
||||||
if (top[FPSTR(_enabled)] != nullptr) {
|
if (top[FPSTR(_enabled)] != nullptr) {
|
||||||
if (top[FPSTR(_enabled)].is<bool>()) {
|
if (top[FPSTR(_enabled)].is<bool>()) {
|
||||||
@ -413,6 +413,7 @@ class MultiRelay : public Usermod {
|
|||||||
}
|
}
|
||||||
DEBUG_PRINTLN(F("MultiRelay config (re)loaded."));
|
DEBUG_PRINTLN(F("MultiRelay config (re)loaded."));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,18 +82,6 @@ class StairwayWipeUsermod : public Usermod {
|
|||||||
//if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!"));
|
//if (root["bri"] == 255) Serial.println(F("Don't burn down your garage!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void addToConfig(JsonObject& root)
|
|
||||||
{
|
|
||||||
JsonObject top = root.createNestedObject("exampleUsermod");
|
|
||||||
top["great"] = userVar0; //save this var persistently whenever settings are saved
|
|
||||||
}
|
|
||||||
|
|
||||||
void readFromConfig(JsonObject& root)
|
|
||||||
{
|
|
||||||
JsonObject top = root["top"];
|
|
||||||
userVar0 = top["great"] | 42; //The value right of the pipe "|" is the default value in case your setting was not present in cfg.json (e.g. first boot)
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t getId()
|
uint16_t getId()
|
||||||
{
|
{
|
||||||
return USERMOD_ID_EXAMPLE;
|
return USERMOD_ID_EXAMPLE;
|
||||||
|
@ -198,14 +198,16 @@ class AutoSaveUsermod : public Usermod {
|
|||||||
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
|
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
|
||||||
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
|
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject& root) {
|
bool readFromConfig(JsonObject& root) {
|
||||||
// we look for JSON object: {"Autosave": {"autoSaveAfterSec": 10, "autoSavePreset": 99}}
|
// we look for JSON object: {"Autosave": {"autoSaveAfterSec": 10, "autoSavePreset": 99}}
|
||||||
JsonObject top = root[FPSTR(_name)];
|
JsonObject top = root[FPSTR(_name)];
|
||||||
if (top.isNull()) {
|
if (top.isNull()) {
|
||||||
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool configComplete = true;
|
||||||
|
|
||||||
if (top[FPSTR(_autoSaveEnabled)].is<bool>()) {
|
if (top[FPSTR(_autoSaveEnabled)].is<bool>()) {
|
||||||
// reading from cfg.json
|
// reading from cfg.json
|
||||||
enabled = top[FPSTR(_autoSaveEnabled)].as<bool>();
|
enabled = top[FPSTR(_autoSaveEnabled)].as<bool>();
|
||||||
@ -225,6 +227,7 @@ class AutoSaveUsermod : public Usermod {
|
|||||||
applyAutoSaveOnBoot = (bool)(str!="off"); // off is guaranteed to be present
|
applyAutoSaveOnBoot = (bool)(str!="off"); // off is guaranteed to be present
|
||||||
}
|
}
|
||||||
DEBUG_PRINTLN(F("Autosave config (re)loaded."));
|
DEBUG_PRINTLN(F("Autosave config (re)loaded."));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -617,12 +617,14 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
|
* but also that if you want to write persistent values to a dynamic buffer, you'd need to allocate it here instead of in setup.
|
||||||
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
|
* If you don't know what that is, don't fret. It most likely doesn't affect your use case :)
|
||||||
*/
|
*/
|
||||||
void readFromConfig(JsonObject& root) {
|
bool readFromConfig(JsonObject& root) {
|
||||||
bool needsRedraw = false;
|
bool needsRedraw = false;
|
||||||
DisplayType newType = type;
|
DisplayType newType = type;
|
||||||
int8_t newScl = sclPin;
|
int8_t newScl = sclPin;
|
||||||
int8_t newSda = sdaPin;
|
int8_t newSda = sdaPin;
|
||||||
|
|
||||||
|
bool configComplete = true;
|
||||||
|
|
||||||
JsonObject top = root[FPSTR(_name)];
|
JsonObject top = root[FPSTR(_name)];
|
||||||
if (!top.isNull() && top["pin"] != nullptr) {
|
if (!top.isNull() && top["pin"] != nullptr) {
|
||||||
newScl = top["pin"][0];
|
newScl = top["pin"][0];
|
||||||
@ -655,6 +657,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
DEBUG_PRINTLN(F("4 Line Display config (re)loaded."));
|
DEBUG_PRINTLN(F("4 Line Display config (re)loaded."));
|
||||||
} else {
|
} else {
|
||||||
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
||||||
|
configComplete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initDone) {
|
if (!initDone) {
|
||||||
@ -672,7 +675,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
sdaPin = newSda;
|
sdaPin = newSda;
|
||||||
if (newScl<0 || newSda<0) {
|
if (newScl<0 || newSda<0) {
|
||||||
type = NONE;
|
type = NONE;
|
||||||
return;
|
return configComplete;
|
||||||
} else
|
} else
|
||||||
type = newType;
|
type = newType;
|
||||||
setup();
|
setup();
|
||||||
@ -682,6 +685,7 @@ class FourLineDisplayUsermod : public Usermod {
|
|||||||
setFlipMode(flip);
|
setFlipMode(flip);
|
||||||
if (needsRedraw && !wakeDisplay()) redraw(true);
|
if (needsRedraw && !wakeDisplay()) redraw(true);
|
||||||
}
|
}
|
||||||
|
return configComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -60,6 +60,10 @@
|
|||||||
#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
|
#define DEFAULT_LED_TYPE TYPE_WS2812_RGB
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if MAX_NUM_SEGMENTS < WLED_MAX_BUSSES
|
||||||
|
#error "Max segments must be at least max number of busses!"
|
||||||
|
#endif
|
||||||
|
|
||||||
//do not call this method from system context (network callback)
|
//do not call this method from system context (network callback)
|
||||||
void WS2812FX::finalizeInit(void)
|
void WS2812FX::finalizeInit(void)
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,10 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
|
|
||||||
DEBUG_PRINTLN(F("Starting usermod config."));
|
DEBUG_PRINTLN(F("Starting usermod config."));
|
||||||
JsonObject usermods_settings = doc["um"];
|
JsonObject usermods_settings = doc["um"];
|
||||||
if (!usermods_settings.isNull()) usermods.readFromConfig(usermods_settings);
|
if (!usermods_settings.isNull()) {
|
||||||
|
bool allComplete = usermods.readFromConfig(usermods_settings);
|
||||||
|
if (!allComplete && fromFS) serializeConfig();
|
||||||
|
}
|
||||||
|
|
||||||
if (fromFS) return false;
|
if (fromFS) return false;
|
||||||
doReboot = doc[F("rb")] | doReboot;
|
doReboot = doc[F("rb")] | doReboot;
|
||||||
@ -413,11 +416,10 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void deserializeConfigFromFS() {
|
void deserializeConfigFromFS() {
|
||||||
bool fromeep = false;
|
|
||||||
bool success = deserializeConfigSec();
|
bool success = deserializeConfigSec();
|
||||||
if (!success) { //if file does not exist, try reading from EEPROM
|
if (!success) { //if file does not exist, try reading from EEPROM
|
||||||
deEEPSettings();
|
deEEPSettings();
|
||||||
fromeep = true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
@ -426,7 +428,7 @@ void deserializeConfigFromFS() {
|
|||||||
|
|
||||||
success = readObjectFromFile("/cfg.json", nullptr, &doc);
|
success = readObjectFromFile("/cfg.json", nullptr, &doc);
|
||||||
if (!success) { //if file does not exist, try reading from EEPROM
|
if (!success) { //if file does not exist, try reading from EEPROM
|
||||||
if (!fromeep) deEEPSettings();
|
deEEPSettings();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
color: white;
|
color: white;
|
||||||
border: 0px solid white;
|
border: 0px solid white;
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
filter: drop-shadow(0px 0px 1px #000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
|
@ -192,7 +192,7 @@ class Usermod {
|
|||||||
virtual void addToJsonInfo(JsonObject& obj) {}
|
virtual void addToJsonInfo(JsonObject& obj) {}
|
||||||
virtual void readFromJsonState(JsonObject& obj) {}
|
virtual void readFromJsonState(JsonObject& obj) {}
|
||||||
virtual void addToConfig(JsonObject& obj) {}
|
virtual void addToConfig(JsonObject& obj) {}
|
||||||
virtual void readFromConfig(JsonObject& obj) {}
|
virtual bool readFromConfig(JsonObject& obj) { return true; } //Heads up! readFromConfig() now needs to return a bool
|
||||||
virtual void onMqttConnect(bool sessionPresent) {}
|
virtual void onMqttConnect(bool sessionPresent) {}
|
||||||
virtual bool onMqttMessage(char* topic, char* payload) { return false; }
|
virtual bool onMqttMessage(char* topic, char* payload) { return false; }
|
||||||
virtual uint16_t getId() {return USERMOD_ID_UNSPECIFIED;}
|
virtual uint16_t getId() {return USERMOD_ID_UNSPECIFIED;}
|
||||||
@ -211,7 +211,7 @@ class UsermodManager {
|
|||||||
void addToJsonInfo(JsonObject& obj);
|
void addToJsonInfo(JsonObject& obj);
|
||||||
void readFromJsonState(JsonObject& obj);
|
void readFromJsonState(JsonObject& obj);
|
||||||
void addToConfig(JsonObject& obj);
|
void addToConfig(JsonObject& obj);
|
||||||
void readFromConfig(JsonObject& obj);
|
bool readFromConfig(JsonObject& obj);
|
||||||
void onMqttConnect(bool sessionPresent);
|
void onMqttConnect(bool sessionPresent);
|
||||||
bool onMqttMessage(char* topic, char* payload);
|
bool onMqttMessage(char* topic, char* payload);
|
||||||
bool add(Usermod* um);
|
bool add(Usermod* um);
|
||||||
|
@ -55,7 +55,7 @@ Please do not close or refresh the page :)</div></body></html>)=====";
|
|||||||
const char PAGE_welcome[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta charset="utf-8"><meta
|
const char PAGE_welcome[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta charset="utf-8"><meta
|
||||||
content="width=device-width" name="viewport"><meta name="theme-color"
|
content="width=device-width" name="viewport"><meta name="theme-color"
|
||||||
content="#222222"><title>Welcome!</title><style>
|
content="#222222"><title>Welcome!</title><style>
|
||||||
body{font-family:Verdana,Helvetica,sans-serif;text-align:center;background-color:#222;margin:0;color:#fff}button{outline:0;cursor:pointer;padding:8px;margin:10px;width:230px;text-transform:uppercase;font-family:helvetica;font-size:19px;background-color:#333;color:#fff;border:0 solid #fff;border-radius:25px;filter:drop-shadow(0 0 1px #000)}img{width:950px;max-width:82%;image-rendering:pixelated;image-rendering:crisp-edges;margin:4vh 0 0 0;animation:fi 1s}@keyframes fi{from{opacity:0}to{opacity:1}}.main{animation:fi 1.5s .7s both}
|
body{font-family:Verdana,Helvetica,sans-serif;text-align:center;background-color:#222;margin:0;color:#fff}button{outline:0;cursor:pointer;padding:8px;margin:10px;width:230px;text-transform:uppercase;font-family:helvetica;font-size:19px;background-color:#333;color:#fff;border:0 solid #fff;border-radius:25px}img{width:950px;max-width:82%;image-rendering:pixelated;image-rendering:crisp-edges;margin:4vh 0 0 0;animation:fi 1s}@keyframes fi{from{opacity:0}to{opacity:1}}.main{animation:fi 1.5s .7s both}
|
||||||
</style></head><body><img alt=""
|
</style></head><body><img alt=""
|
||||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG0AAAAfCAMAAADazLOuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAABLUExURQAAAAB81gCU/zKq///mo7sWMN8bO+ZIYtZaAP9rAP+HMsCiG+TAIOnMS0KqNU7KPnLUZOrq6v///4CAgGhoaL+/v6CgoExMTAAAAAlm4O8AAAAZdFJOU////////////////////////////////wABNAq3AAAACXBIWXMAAA7DAAAOwwHHb6hkAAACN0lEQVRIS73VjVLCMBAEYIr8CYKkrdj3f1J37zaXFCpTO+piaDgbPq9px9VQ0qyrvKj4q6m0Zr1h+M7xF1zRmnWzqV9/0d2jttGotO1uv9dUObwej5oqp7fzWVPl8n69aprzoOUUbbvdIbV3OLwitXc6vSG1d7m8I3feSEN0j2CeNbOY4MxigjOLCc4sZsTV2l1cCyy4wIILLLjAxtykltq2rbTU+qi01N5rXNO2leaFORoija2l5MM5a02ac9Ya16Sk5tgaPrUpjZub0BL6YqSxKwbH77XUUmSkJXSl8QtaMuyJhq5maL5nTKVpZC13VmtMpTFT2g4vJjTuGfMzzXftiUZnhdtgb1xofvypRon5TjNnxYN9zJo6K5ruSIzQtGuVZn0x91rKvdHBvm39E7SyZ4y06Gz8BDBFKzsXmhcwyfsGZ9VpbhoiCinaxPNmGWmWWrNU2jB0q6HvOhN1JUtCixQtp2g51ZVUXIPS2RMAD++T2nY/DrDjOMDO4wC7jmNYj3d73nrXug8Yt9uNB8xNU1cKNXWlUFNXCjV1pZhGTE83m2vWfYf/NGj4Bg1zu5JD3/MnH5ZWfLOksbmGWGjgXMN5/C2GXYGFFW9Nmtle6Xut0Gm+JsayCj8z0nhjGvYJzVf4aSzmNYsr+u7Q2JIdoX3YOQjOslmsW1jJ3120nE9gfo79hTaNdcsqVR610lvO47pllae9ReZ805zKo2a3iaY5c75pTmVCA6dJ5H7N0sr/asPwBehb7ifEhusRAAAAAElFTkSuQmCC">
|
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG0AAAAfCAMAAADazLOuAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAABLUExURQAAAAB81gCU/zKq///mo7sWMN8bO+ZIYtZaAP9rAP+HMsCiG+TAIOnMS0KqNU7KPnLUZOrq6v///4CAgGhoaL+/v6CgoExMTAAAAAlm4O8AAAAZdFJOU////////////////////////////////wABNAq3AAAACXBIWXMAAA7DAAAOwwHHb6hkAAACN0lEQVRIS73VjVLCMBAEYIr8CYKkrdj3f1J37zaXFCpTO+piaDgbPq9px9VQ0qyrvKj4q6m0Zr1h+M7xF1zRmnWzqV9/0d2jttGotO1uv9dUObwej5oqp7fzWVPl8n69aprzoOUUbbvdIbV3OLwitXc6vSG1d7m8I3feSEN0j2CeNbOY4MxigjOLCc4sZsTV2l1cCyy4wIILLLjAxtykltq2rbTU+qi01N5rXNO2leaFORoija2l5MM5a02ac9Ya16Sk5tgaPrUpjZub0BL6YqSxKwbH77XUUmSkJXSl8QtaMuyJhq5maL5nTKVpZC13VmtMpTFT2g4vJjTuGfMzzXftiUZnhdtgb1xofvypRon5TjNnxYN9zJo6K5ruSIzQtGuVZn0x91rKvdHBvm39E7SyZ4y06Gz8BDBFKzsXmhcwyfsGZ9VpbhoiCinaxPNmGWmWWrNU2jB0q6HvOhN1JUtCixQtp2g51ZVUXIPS2RMAD++T2nY/DrDjOMDO4wC7jmNYj3d73nrXug8Yt9uNB8xNU1cKNXWlUFNXCjV1pZhGTE83m2vWfYf/NGj4Bg1zu5JD3/MnH5ZWfLOksbmGWGjgXMN5/C2GXYGFFW9Nmtle6Xut0Gm+JsayCj8z0nhjGvYJzVf4aSzmNYsr+u7Q2JIdoX3YOQjOslmsW1jJ3120nE9gfo79hTaNdcsqVR610lvO47pllae9ReZ805zKo2a3iaY5c75pTmVCA6dJ5H7N0sr/asPwBehb7ifEhusRAAAAAElFTkSuQmCC">
|
||||||
<div class="main"><h1>Welcome to WLED!</h1><h3>
|
<div class="main"><h1>Welcome to WLED!</h1><h3>
|
||||||
|
@ -111,8 +111,7 @@ void colorUpdated(int callMode)
|
|||||||
{
|
{
|
||||||
effectChanged = false;
|
effectChanged = false;
|
||||||
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
||||||
if (isPreset) {isPreset = false;}
|
currentPreset = -1; //something changed, so we are no longer in the preset
|
||||||
else {currentPreset = -1;}
|
|
||||||
|
|
||||||
notify(callMode);
|
notify(callMode);
|
||||||
|
|
||||||
|
@ -29,7 +29,6 @@ bool applyPreset(byte index)
|
|||||||
|
|
||||||
if (!errorFlag) {
|
if (!errorFlag) {
|
||||||
currentPreset = index;
|
currentPreset = index;
|
||||||
isPreset = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,7 +13,13 @@ void UsermodManager::addToJsonState(JsonObject& obj) { for (byte i = 0; i < n
|
|||||||
void UsermodManager::addToJsonInfo(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToJsonInfo(obj); }
|
void UsermodManager::addToJsonInfo(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToJsonInfo(obj); }
|
||||||
void UsermodManager::readFromJsonState(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromJsonState(obj); }
|
void UsermodManager::readFromJsonState(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromJsonState(obj); }
|
||||||
void UsermodManager::addToConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToConfig(obj); }
|
void UsermodManager::addToConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->addToConfig(obj); }
|
||||||
void UsermodManager::readFromConfig(JsonObject& obj) { for (byte i = 0; i < numMods; i++) ums[i]->readFromConfig(obj); }
|
bool UsermodManager::readFromConfig(JsonObject& obj) {
|
||||||
|
bool allComplete = true;
|
||||||
|
for (byte i = 0; i < numMods; i++) {
|
||||||
|
if (!ums[i]->readFromConfig(obj)) allComplete = false;
|
||||||
|
}
|
||||||
|
return allComplete;
|
||||||
|
}
|
||||||
void UsermodManager::onMqttConnect(bool sessionPresent) { for (byte i = 0; i < numMods; i++) ums[i]->onMqttConnect(sessionPresent); }
|
void UsermodManager::onMqttConnect(bool sessionPresent) { for (byte i = 0; i < numMods; i++) ums[i]->onMqttConnect(sessionPresent); }
|
||||||
bool UsermodManager::onMqttMessage(char* topic, char* payload) {
|
bool UsermodManager::onMqttMessage(char* topic, char* payload) {
|
||||||
for (byte i = 0; i < numMods; i++) if (ums[i]->onMqttMessage(topic, payload)) return true;
|
for (byte i = 0; i < numMods; i++) if (ums[i]->onMqttMessage(topic, payload)) return true;
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
* || || ||
|
* || || ||
|
||||||
* \/ \/ \/
|
* \/ \/ \/
|
||||||
*/
|
*/
|
||||||
//#include "usermod_v2_example.h"
|
//#include "../usermods/EXAMPLE_v2/usermod_v2_example.h"
|
||||||
|
|
||||||
#ifdef USERMOD_DALLASTEMPERATURE
|
#ifdef USERMOD_DALLASTEMPERATURE
|
||||||
#include "../usermods/Temperature/usermod_temperature.h"
|
#include "../usermods/Temperature/usermod_temperature.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2106202
|
#define VERSION 2106251
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
@ -558,7 +558,6 @@ WLED_GLOBAL bool doCloseFile _INIT(false);
|
|||||||
|
|
||||||
// presets
|
// presets
|
||||||
WLED_GLOBAL int16_t currentPreset _INIT(-1);
|
WLED_GLOBAL int16_t currentPreset _INIT(-1);
|
||||||
WLED_GLOBAL bool isPreset _INIT(false);
|
|
||||||
|
|
||||||
WLED_GLOBAL byte errorFlag _INIT(0);
|
WLED_GLOBAL byte errorFlag _INIT(0);
|
||||||
|
|
||||||
|
@ -479,5 +479,9 @@ void deEEPSettings() {
|
|||||||
loadSettingsFromEEPROM();
|
loadSettingsFromEEPROM();
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
|
|
||||||
|
//call readFromConfig() with an empty object so that usermods can initialize to defaults prior to saving
|
||||||
|
JsonObject empty = JsonObject();
|
||||||
|
usermods.readFromConfig(empty);
|
||||||
|
|
||||||
serializeConfig();
|
serializeConfig();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user