From f3fb14d4213bb44c7859a113c30649e52daa9fa4 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 7 Jun 2023 20:31:50 -0500 Subject: [PATCH] Revert "cleanups" This reverts commit 3cdb077f058a4d39d10253c121cbbeca4c7d2434. --- components/ratgdo/ratgdo.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 55d0078..312c3dd 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -190,8 +190,8 @@ namespace ratgdo { } else if (cmd == 0x281) { light ^= 1; // toggle bit ESP_LOGD(TAG, "Light: %d (toggle)", light); - } else if (cmd == 0x84) { + ESP_LOGD(TAG, "Unknown 0x84"); } else if (cmd == 0x280) { ESP_LOGD(TAG, "Pressed: %s", byte1 == 1 ? "pressed" : "released"); } else if (cmd == 0x48c) { @@ -585,6 +585,9 @@ namespace ratgdo { ESP_LOGD(TAG, "The light is already on"); } else { toggleLight(); + // We don't always get the state back so be optimistic + this->previousLightState = this->lightState; + this->lightState = LightState::LIGHT_STATE_ON; } } @@ -594,6 +597,9 @@ namespace ratgdo { ESP_LOGD(TAG, "The light is already off"); } else { toggleLight(); + // We don't always get the state back so be optimistic + this->previousLightState = this->lightState; + this->lightState = LightState::LIGHT_STATE_OFF; } }