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