This commit is contained in:
J. Nick Koston 2023-06-07 14:05:01 -05:00
parent eccbd7e581
commit ad987adb3c
No known key found for this signature in database
2 changed files with 7 additions and 10 deletions

View File

@ -505,10 +505,8 @@ namespace ratgdo {
transmit(Commands::REBOOT5); transmit(Commands::REBOOT5);
delay(65); delay(65);
transmit(Commands::REBOOT6); sendCommandAndSaveCounter(Commands::REBOOT6);
delay(65); delay(65);
this->pref_.save(&this->rollingCodeCounter);
} }
void RATGDOComponent::openDoor() void RATGDOComponent::openDoor()
@ -541,9 +539,8 @@ namespace ratgdo {
void RATGDOComponent::toggleDoor() void RATGDOComponent::toggleDoor()
{ {
transmit(Commands::DOOR1); transmit(Commands::DOOR1);
delay(65); delay(40);
transmit(Commands::DOOR2); sendCommandAndSaveCounter(Commands::DOOR2);
this->pref_.save(&this->rollingCodeCounter);
} }
void RATGDOComponent::lightOn() void RATGDOComponent::lightOn()
@ -566,7 +563,7 @@ namespace ratgdo {
void RATGDOComponent::toggleLight() void RATGDOComponent::toggleLight()
{ {
sendCommand(Commands::LIGHT); sendCommandAndSaveCounter(Commands::LIGHT);
} }
// Lock functions // Lock functions
@ -590,10 +587,10 @@ namespace ratgdo {
void RATGDOComponent::toggleLock() void RATGDOComponent::toggleLock()
{ {
sendCommand(Commands::LOCK); sendCommandAndSaveCounter(Commands::LOCK);
} }
void RATGDOComponent::sendCommand(Commands command) void RATGDOComponent::sendCommandAndSaveCounter(Commands command)
{ {
transmit(command); transmit(command);
this->pref_.save(&this->rollingCodeCounter); this->pref_.save(&this->rollingCodeCounter);

View File

@ -128,7 +128,7 @@ namespace ratgdo {
void gdoStateLoop(); void gdoStateLoop();
void statusUpdateLoop(); void statusUpdateLoop();
void readRollingCode(uint8_t& door, uint8_t& light, uint8_t& lock, uint8_t& motion, uint8_t& obstruction); void readRollingCode(uint8_t& door, uint8_t& light, uint8_t& lock, uint8_t& motion, uint8_t& obstruction);
void sendCommand(Commands command); void sendCommandAndSaveCounter(Commands command);
/** Register a child component. */ /** Register a child component. */
void register_child(RATGDOClient* obj); void register_child(RATGDOClient* obj);