diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index b4fc984..1187517 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -153,6 +153,10 @@ namespace ratgdo { void RATGDOComponent::sendRollingCodeChanged() { + if (!this->rollingCodeUpdatesEnabled_) { + ESP_LOGD(TAG, "Rolling code updates disabled"); + return; + } for (auto* child : this->children_) { child->on_rolling_code_change(this->rollingCodeCounter); } @@ -368,6 +372,7 @@ namespace ratgdo { void RATGDOComponent::sync() { + this->rollingCodeUpdatesEnabled_ = false; for (int i = 0; i <= MAX_CODES_WITHOUT_FLASH_WRITE; i++) { transmit(Command.REBOOT1); delay(65); @@ -380,6 +385,7 @@ namespace ratgdo { delay(65); transmit(Command.REBOOT5); delay(65); + this->rollingCodeUpdatesEnabled_ = true; sendCommandAndSaveCounter(Command.REBOOT6); delay(65); } diff --git a/components/ratgdo/ratgdo.h b/components/ratgdo/ratgdo.h index 176c142..7dea501 100644 --- a/components/ratgdo/ratgdo.h +++ b/components/ratgdo/ratgdo.h @@ -147,6 +147,7 @@ namespace ratgdo { protected: ESPPreferenceObject pref_; std::vector children_; + bool rollingCodeUpdatesEnabled_ { true }; bool forceUpdate_ { false }; RATGDOStore store_ {};