Bugfix.
- temperature default values - IR warnings
This commit is contained in:
parent
6b5c2be701
commit
2f30451067
@ -238,8 +238,9 @@ class UsermodTemperature : public Usermod {
|
|||||||
// 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() && 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>();
|
||||||
} else {
|
} else {
|
||||||
@ -247,6 +248,9 @@ class UsermodTemperature : public Usermod {
|
|||||||
disabled = (bool)(str=="off"); // off is guaranteed to be present
|
disabled = (bool)(str=="off"); // off is guaranteed to be present
|
||||||
}
|
}
|
||||||
newTemperaturePin = min(39,max(-1,top["pin"].as<int>()));
|
newTemperaturePin = min(39,max(-1,top["pin"].as<int>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top["degC"] != nullptr) {
|
||||||
if (top["degC"].is<bool>()) {
|
if (top["degC"].is<bool>()) {
|
||||||
// reading from cfg.json
|
// reading from cfg.json
|
||||||
degC = top["degC"].as<bool>();
|
degC = top["degC"].as<bool>();
|
||||||
@ -255,7 +259,13 @@ class UsermodTemperature : public Usermod {
|
|||||||
String str = top["degC"]; // checkbox -> off or on
|
String str = top["degC"]; // checkbox -> off or on
|
||||||
degC = (bool)(str!="off"); // off is guaranteed to be present
|
degC = (bool)(str!="off"); // off is guaranteed to be present
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top[FPSTR(_readInterval)] != nullptr) {
|
||||||
readingInterval = min(120,max(10,top[FPSTR(_readInterval)].as<int>())) * 1000; // convert to ms
|
readingInterval = min(120,max(10,top[FPSTR(_readInterval)].as<int>())) * 1000; // convert to ms
|
||||||
|
}
|
||||||
|
|
||||||
|
if (top[FPSTR(_parasite)] != nullptr) {
|
||||||
if (top[FPSTR(_parasite)].is<bool>()) {
|
if (top[FPSTR(_parasite)].is<bool>()) {
|
||||||
// reading from cfg.json
|
// reading from cfg.json
|
||||||
parasite = top[FPSTR(_parasite)].as<bool>();
|
parasite = top[FPSTR(_parasite)].as<bool>();
|
||||||
@ -264,8 +274,6 @@ class UsermodTemperature : public Usermod {
|
|||||||
String str = top[FPSTR(_parasite)]; // checkbox -> off or on
|
String str = top[FPSTR(_parasite)]; // checkbox -> off or on
|
||||||
parasite = (bool)(str!="off"); // off is guaranteed to be present
|
parasite = (bool)(str!="off"); // off is guaranteed to be present
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
DEBUG_PRINTLN(F("No config found. (Using defaults.)"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initDone) {
|
if (!initDone) {
|
||||||
|
@ -570,7 +570,7 @@ void decodeIRJson(uint32_t code)
|
|||||||
JsonObject fdo;
|
JsonObject fdo;
|
||||||
JsonObject jsonCmdObj;
|
JsonObject jsonCmdObj;
|
||||||
|
|
||||||
sprintf_P(objKey, PSTR("\"0x%lX\":"), code);
|
sprintf_P(objKey, PSTR("\"0x%lX\":"), (unsigned long)code);
|
||||||
|
|
||||||
errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_PLOAD;
|
errorFlag = readObjectFromFile("/ir.json", objKey, &irDoc) ? ERR_NONE : ERR_FS_PLOAD;
|
||||||
fdo = irDoc.as<JsonObject>();
|
fdo = irDoc.as<JsonObject>();
|
||||||
@ -643,7 +643,7 @@ void handleIR()
|
|||||||
{
|
{
|
||||||
if (results.value != 0) // only print results if anything is received ( != 0 )
|
if (results.value != 0) // only print results if anything is received ( != 0 )
|
||||||
{
|
{
|
||||||
DEBUG_PRINTF("IR recv: 0x%lX\n", (uint32_t)results.value);
|
DEBUG_PRINTF("IR recv: 0x%lX\n", (unsigned long)results.value);
|
||||||
}
|
}
|
||||||
decodeIR(results.value);
|
decodeIR(results.value);
|
||||||
irrecv->resume();
|
irrecv->resume();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2105261
|
#define VERSION 2105262
|
||||||
|
|
||||||
//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
|
||||||
|
Loading…
Reference in New Issue
Block a user