tweak
This commit is contained in:
parent
72d131721b
commit
ffb12e5098
|
@ -257,12 +257,20 @@ namespace ratgdo {
|
||||||
printRollingCode();
|
printRollingCode();
|
||||||
|
|
||||||
if (command != Commands::DOOR1) { // door2 is created with same counter and should always be called after door1
|
if (command != Commands::DOOR1) { // door2 is created with same counter and should always be called after door1
|
||||||
ESP_LOGD(TAG, "Incrementing rolling code counter");
|
incrementRollingCodeCounter();
|
||||||
this->rollingCodeCounter = (this->rollingCodeCounter + 1) & 0xfffffff;
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RATGDOComponent::incrementRollingCodeCounter()
|
||||||
|
{
|
||||||
|
ESP_LOGD(TAG, "Incrementing rolling code counter");
|
||||||
|
this->rollingCodeCounter = (this->rollingCodeCounter + 1) & 0xfffffff;
|
||||||
|
for (auto* child : this->children_) {
|
||||||
|
child->on_rolling_code_change(this->rollingCodeCounter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RATGDOComponent::printRollingCode()
|
void RATGDOComponent::printRollingCode()
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG, "Counter: %d Send code: [%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X]",
|
ESP_LOGD(TAG, "Counter: %d Send code: [%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X]",
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace ratgdo {
|
||||||
void RATGDOClient::on_lock_state(LockState state) {};
|
void RATGDOClient::on_lock_state(LockState state) {};
|
||||||
void RATGDOClient::on_motion_state(MotionState state) {};
|
void RATGDOClient::on_motion_state(MotionState state) {};
|
||||||
void RATGDOClient::on_obstruction_state(ObstructionState state) {};
|
void RATGDOClient::on_obstruction_state(ObstructionState state) {};
|
||||||
|
void RATGDOClient::on_rolling_code_change(uint32_t rollingCodeCounter) {};
|
||||||
|
|
||||||
} // namespace ratgdo
|
} // namespace ratgdo
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace ratgdo {
|
||||||
virtual void on_lock_state(LockState state);
|
virtual void on_lock_state(LockState state);
|
||||||
virtual void on_motion_state(MotionState state);
|
virtual void on_motion_state(MotionState state);
|
||||||
virtual void on_obstruction_state(ObstructionState state);
|
virtual void on_obstruction_state(ObstructionState state);
|
||||||
|
virtual void on_rolling_code_change(uint32_t rollingCodeCounter);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend RATGDOComponent;
|
friend RATGDOComponent;
|
||||||
|
|
Loading…
Reference in New Issue