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

View File

@ -128,7 +128,7 @@ namespace ratgdo {
void gdoStateLoop();
void statusUpdateLoop();
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. */
void register_child(RATGDOClient* obj);