Merge branch 'master' into dev

This commit is contained in:
Blaz Kristan
2021-06-25 15:52:59 +02:00
23 changed files with 1045 additions and 986 deletions

View File

@@ -234,12 +234,13 @@ class UsermodTemperature : public Usermod {
/**
* 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}}
JsonObject top = root[FPSTR(_name)];
int8_t newTemperaturePin = temperaturePin;
if (top.isNull()) return;
if (top.isNull()) return true;
bool configComplete = true;
if (top["pin"] != nullptr) {
if (top[FPSTR(_enabled)].is<bool>()) {
disabled = !top[FPSTR(_enabled)].as<bool>();
@@ -282,6 +283,7 @@ class UsermodTemperature : public Usermod {
DEBUG_PRINTLN(F("Temperature config loaded."));
} else {
DEBUG_PRINTLN(F("Temperature config re-loaded."));
configComplete = false;
// changing paramters from settings page
if (newTemperaturePin != temperaturePin) {
// deallocate pin and release memory
@@ -292,6 +294,7 @@ class UsermodTemperature : public Usermod {
setup();
}
}
return configComplete;
}
uint16_t getId()