Merge pull request #2851 from albarlow/BH1750-Enabled-Bugfix
Fix Enabled Toggle on BH1750
This commit is contained in:
commit
69a111ee35
@ -42,7 +42,7 @@ private:
|
|||||||
bool getLuminanceComplete = false;
|
bool getLuminanceComplete = false;
|
||||||
|
|
||||||
// flag set at startup
|
// flag set at startup
|
||||||
bool disabled = false;
|
bool enabled = true;
|
||||||
|
|
||||||
// strings to reduce flash memory usage (used more than twice)
|
// strings to reduce flash memory usage (used more than twice)
|
||||||
static const char _name[];
|
static const char _name[];
|
||||||
@ -133,7 +133,7 @@ public:
|
|||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
if (disabled || strip.isUpdating())
|
if ((!enabled) || strip.isUpdating())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
@ -205,7 +205,7 @@ public:
|
|||||||
{
|
{
|
||||||
// we add JSON object.
|
// we add JSON object.
|
||||||
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
|
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
|
||||||
top[FPSTR(_enabled)] = !disabled;
|
top[FPSTR(_enabled)] = enabled;
|
||||||
top[FPSTR(_maxReadInterval)] = maxReadingInterval;
|
top[FPSTR(_maxReadInterval)] = maxReadingInterval;
|
||||||
top[FPSTR(_minReadInterval)] = minReadingInterval;
|
top[FPSTR(_minReadInterval)] = minReadingInterval;
|
||||||
top[FPSTR(_HomeAssistantDiscovery)] = HomeAssistantDiscovery;
|
top[FPSTR(_HomeAssistantDiscovery)] = HomeAssistantDiscovery;
|
||||||
@ -233,7 +233,7 @@ public:
|
|||||||
}
|
}
|
||||||
bool configComplete = !top.isNull();
|
bool configComplete = !top.isNull();
|
||||||
|
|
||||||
configComplete &= getJsonValue(top[FPSTR(_enabled)], disabled, false);
|
configComplete &= getJsonValue(top[FPSTR(_enabled)], enabled, false);
|
||||||
configComplete &= getJsonValue(top[FPSTR(_maxReadInterval)], maxReadingInterval, 10000); //ms
|
configComplete &= getJsonValue(top[FPSTR(_maxReadInterval)], maxReadingInterval, 10000); //ms
|
||||||
configComplete &= getJsonValue(top[FPSTR(_minReadInterval)], minReadingInterval, 500); //ms
|
configComplete &= getJsonValue(top[FPSTR(_minReadInterval)], minReadingInterval, 500); //ms
|
||||||
configComplete &= getJsonValue(top[FPSTR(_HomeAssistantDiscovery)], HomeAssistantDiscovery, false);
|
configComplete &= getJsonValue(top[FPSTR(_HomeAssistantDiscovery)], HomeAssistantDiscovery, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user