This commit is contained in:
J. Nick Koston 2023-06-05 21:26:35 -05:00
parent b7f789b756
commit f6034ac482
No known key found for this signature in database
1 changed files with 12 additions and 20 deletions

View File

@ -421,41 +421,36 @@ namespace ratgdo {
* The opener requires a specific duration low/high pulse before it will accept * The opener requires a specific duration low/high pulse before it will accept
* a message * a message
*/ */
void RATGDOComponent::transmit(const uint8_t* payload) void RATGDOComponent::transmit(const char* command)
{ {
getRollingCode(command);
this->output_gdo_pin_->digital_write(true); // pull the line high for 1305 micros so the this->output_gdo_pin_->digital_write(true); // pull the line high for 1305 micros so the
// door opener responds to the message // door opener responds to the message
delayMicroseconds(1305); delayMicroseconds(1305);
this->output_gdo_pin_->digital_write(false); // bring the line low this->output_gdo_pin_->digital_write(false); // bring the line low
delayMicroseconds(1260); // "LOW" pulse duration before the message start delayMicroseconds(1260); // "LOW" pulse duration before the message start
this->write_array(payload, CODE_LENGTH); this->write_array(this->txRollingCode, CODE_LENGTH);
} }
void RATGDOComponent::sync() void RATGDOComponent::sync()
{ {
getRollingCode("reboot1"); transmit("reboot1");
transmit(this->txRollingCode);
delay(65); delay(65);
getRollingCode("reboot2"); transmit("reboot2");
transmit(this->txRollingCode);
delay(65); delay(65);
getRollingCode("reboot3"); transmit("reboot3");
transmit(this->txRollingCode);
delay(65); delay(65);
getRollingCode("reboot4"); transmit("reboot4");
transmit(this->txRollingCode);
delay(65); delay(65);
getRollingCode("reboot5"); transmit("reboot5");
transmit(this->txRollingCode);
delay(65); delay(65);
getRollingCode("reboot6"); transmit("reboot6");
transmit(this->txRollingCode);
delay(65); delay(65);
this->pref_.save(&this->rollingCodeCounter); this->pref_.save(&this->rollingCodeCounter);
@ -490,11 +485,9 @@ namespace ratgdo {
void RATGDOComponent::toggleDoor() void RATGDOComponent::toggleDoor()
{ {
getRollingCode("door1"); transmit("door1");
transmit(this->txRollingCode);
delay(40); delay(40);
getRollingCode("door2"); transmit("door2");
transmit(this->txRollingCode);
this->pref_.save(&this->rollingCodeCounter); this->pref_.save(&this->rollingCodeCounter);
} }
@ -547,8 +540,7 @@ namespace ratgdo {
void RATGDOComponent::sendCommand(const char* command) void RATGDOComponent::sendCommand(const char* command)
{ {
getRollingCode(command); transmit(command);
transmit(this->txRollingCode);
this->pref_.save(&this->rollingCodeCounter); this->pref_.save(&this->rollingCodeCounter);
} }