mirror of
https://github.com/wled/WLED.git
synced 2025-07-25 03:36:45 +00:00
Minor changes in PIR usermod.
This commit is contained in:
parent
04aa22b510
commit
90516217e0
@ -257,6 +257,8 @@ public:
|
||||
uiDomString += "</button>";
|
||||
infoArr.add(uiDomString); //value
|
||||
|
||||
if (m_PIRenabled)
|
||||
{
|
||||
//this code adds "u":{"⏲ switch off timer":uiDomString} to the info object
|
||||
uiDomString = "<i class=\"icons\"></i> switch off timer<span style=\"display:block;padding-left:25px;\">\
|
||||
after <input type=\"number\" min=\"1\" max=\"720\" value=\"";
|
||||
@ -296,6 +298,7 @@ after <input type=\"number\" min=\"1\" max=\"720\" value=\"";
|
||||
infoArr.add("inactive");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* addToJsonState() can be used to add custom entries to the /json/state part of the JSON API (state object).
|
||||
@ -323,9 +326,9 @@ after <input type=\"number\" min=\"1\" max=\"720\" value=\"";
|
||||
m_updateConfig = true;
|
||||
}
|
||||
|
||||
if (root[F("pin")] != nullptr)
|
||||
if (root["pin"] != nullptr)
|
||||
{
|
||||
int8_t pin = (int)root[F("pin")];
|
||||
int8_t pin = (int)root["pin"];
|
||||
// check if pin is OK
|
||||
if (pin != PIRsensorPin && pin>=0 && pinManager.allocatePin(pin,false)) {
|
||||
// deallocate old pin
|
||||
@ -379,8 +382,8 @@ after <input type=\"number\" min=\"1\" max=\"720\" value=\"";
|
||||
void readFromConfig(JsonObject &root)
|
||||
{
|
||||
JsonObject top = root[F("PIRsensorSwitch")];
|
||||
if (!top.isNull() && top[F("pin")] != nullptr) {
|
||||
PIRsensorPin = (int)top[F("pin")];
|
||||
if (!top.isNull() && top["pin"] != nullptr) {
|
||||
PIRsensorPin = (int)top["pin"];
|
||||
}
|
||||
m_PIRenabled = (top[F("PIRenabled")] != nullptr ? top[F("PIRenabled")] : true);
|
||||
m_switchOffDelay = top[F("PIRoffSec")] | m_switchOffDelay;
|
||||
|
Loading…
x
Reference in New Issue
Block a user