Too much yield()ing hutrs.

This commit is contained in:
Blaz Kristan 2021-10-18 20:00:11 +02:00
parent 8e9269fdf9
commit 97c1a2245b

View File

@ -200,7 +200,6 @@ class MultiRelay : public Usermod {
pinMode(_relay[relay].pin, OUTPUT); pinMode(_relay[relay].pin, OUTPUT);
digitalWrite(_relay[relay].pin, mode ? !_relay[relay].mode : _relay[relay].mode); digitalWrite(_relay[relay].pin, mode ? !_relay[relay].mode : _relay[relay].mode);
publishMqtt(mode ? "on" : "off", relay); publishMqtt(mode ? "on" : "off", relay);
yield();
} }
/** /**
@ -288,6 +287,7 @@ class MultiRelay : public Usermod {
* loop() is called continuously. Here you can check for events, read sensors, etc. * loop() is called continuously. Here you can check for events, read sensors, etc.
*/ */
void loop() { void loop() {
yield();
if (!enabled || strip.isUpdating()) return; if (!enabled || strip.isUpdating()) return;
static unsigned long lastUpdate = 0; static unsigned long lastUpdate = 0;
@ -312,6 +312,7 @@ class MultiRelay : public Usermod {
* Replicating button.cpp * Replicating button.cpp
*/ */
bool handleButton(uint8_t b) { bool handleButton(uint8_t b) {
yield();
if (buttonType[b] == BTN_TYPE_NONE || buttonType[b] == BTN_TYPE_RESERVED || buttonType[b] == BTN_TYPE_PIR_SENSOR || buttonType[b] == BTN_TYPE_ANALOG || buttonType[b] == BTN_TYPE_ANALOG_INVERTED) { if (buttonType[b] == BTN_TYPE_NONE || buttonType[b] == BTN_TYPE_RESERVED || buttonType[b] == BTN_TYPE_PIR_SENSOR || buttonType[b] == BTN_TYPE_ANALOG || buttonType[b] == BTN_TYPE_ANALOG_INVERTED) {
return false; return false;
} }