This commit is contained in:
J. Nick Koston 2023-06-09 18:53:09 -05:00
parent 9f2298a645
commit ce337af150
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -153,6 +153,10 @@ namespace ratgdo {
void RATGDOComponent::sendRollingCodeChanged() void RATGDOComponent::sendRollingCodeChanged()
{ {
if (!this->rollingCodeUpdatesEnabled_) {
ESP_LOGD(TAG, "Rolling code updates disabled");
return;
}
for (auto* child : this->children_) { for (auto* child : this->children_) {
child->on_rolling_code_change(this->rollingCodeCounter); child->on_rolling_code_change(this->rollingCodeCounter);
} }
@ -368,6 +372,7 @@ namespace ratgdo {
void RATGDOComponent::sync() void RATGDOComponent::sync()
{ {
this->rollingCodeUpdatesEnabled_ = false;
for (int i = 0; i <= MAX_CODES_WITHOUT_FLASH_WRITE; i++) { for (int i = 0; i <= MAX_CODES_WITHOUT_FLASH_WRITE; i++) {
transmit(Command.REBOOT1); transmit(Command.REBOOT1);
delay(65); delay(65);
@ -380,6 +385,7 @@ namespace ratgdo {
delay(65); delay(65);
transmit(Command.REBOOT5); transmit(Command.REBOOT5);
delay(65); delay(65);
this->rollingCodeUpdatesEnabled_ = true;
sendCommandAndSaveCounter(Command.REBOOT6); sendCommandAndSaveCounter(Command.REBOOT6);
delay(65); delay(65);
} }

View File

@ -147,6 +147,7 @@ namespace ratgdo {
protected: protected:
ESPPreferenceObject pref_; ESPPreferenceObject pref_;
std::vector<RATGDOClient*> children_; std::vector<RATGDOClient*> children_;
bool rollingCodeUpdatesEnabled_ { true };
bool forceUpdate_ { false }; bool forceUpdate_ { false };
RATGDOStore store_ {}; RATGDOStore store_ {};