auto name

This commit is contained in:
Paul Wieland 2024-08-01 12:33:01 -04:00
parent 75bbe9ce6e
commit c3dcf6509b
2 changed files with 5 additions and 2 deletions

View File

@ -61,7 +61,7 @@ namespace ratgdo {
}); });
// A second subscription, which seem to overwrite the first subscription // A second subscription, which seem to overwrite the first subscription
this->parent_->subscribe_rolling_code_counter([=](uint32_t value, const std::string &name = "rolling_code_counter2") { this->parent_->subscribe_rolling_code_counter([=](uint32_t value) {
ESP_LOGD("XXX","A second rolling code counter subscription"); ESP_LOGD("XXX","A second rolling code counter subscription");
}); });

View File

@ -597,8 +597,11 @@ namespace ratgdo {
this->protocol_->call(InactivateLearn {}); this->protocol_->call(InactivateLearn {});
} }
void RATGDOComponent::subscribe_rolling_code_counter(std::function<void(uint32_t)>&& f, const std::string &name) void RATGDOComponent::subscribe_rolling_code_counter(std::function<void(uint32_t)>&& f)
{ {
static int num = 0;
auto name = "rolling_code_counter" + std::to_string(num++);
// change update to children is defered until after component loop // change update to children is defered until after component loop
// if multiple changes occur during component loop, only the last one is notified // if multiple changes occur during component loop, only the last one is notified
auto counter = this->protocol_->call(GetRollingCodeCounter {}); auto counter = this->protocol_->call(GetRollingCodeCounter {});