This commit is contained in:
J. Nick Koston 2023-06-09 18:43:43 -05:00
parent a66b446103
commit 53d9c62732
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

View File

@ -477,7 +477,10 @@ namespace ratgdo {
{
transmit(command);
this->pref_.save(&this->rollingCodeCounter);
global_preferences->sync();
if (!this->lastSyncedRollingCodeCounter || this->rollingCodeCounter - this->lastSyncedRollingCodeCounter > 2) {
this->lastSyncedRollingCodeCounter = this->rollingCodeCounter;
global_preferences->sync();
}
}
void RATGDOComponent::register_child(RATGDOClient* obj)

View File

@ -82,9 +82,11 @@ namespace ratgdo {
void loop() override;
void dump_config() override;
uint32_t rollingCodeCounter;
uint32_t rollingCodeCounter{ 0};
uint32_t lastSyncedRollingCodeCounter{ 0};
uint16_t previousOpenings { 0 }; // number of times the door has been opened
uint16_t openings; // number of times the door has been opened
uint16_t openings{0}; // number of times the door has been opened
uint8_t txRollingCode[CODE_LENGTH];
uint8_t rxRollingCode[CODE_LENGTH];