clang-format
This commit is contained in:
parent
bc7a59b75b
commit
9d8e5dae56
|
@ -27,7 +27,6 @@ namespace ratgdo {
|
||||||
std::vector<std::function<void(Ts...)>> callbacks_;
|
std::vector<std::function<void(Ts...)>> callbacks_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename... X>
|
template <typename... X>
|
||||||
class ExpiringCallbacks;
|
class ExpiringCallbacks;
|
||||||
|
|
||||||
|
@ -35,9 +34,9 @@ namespace ratgdo {
|
||||||
class ExpiringCallbacks<void(Ts...)> {
|
class ExpiringCallbacks<void(Ts...)> {
|
||||||
public:
|
public:
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
void operator()(uint32_t expiration, Callback&& callback)
|
void operator()(uint32_t expiration, Callback&& callback)
|
||||||
{
|
{
|
||||||
this->callbacks_.push_back(std::make_pair(expiration, std::forward<Callback>(callback)));
|
this->callbacks_.push_back(std::make_pair(expiration, std::forward<Callback>(callback)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void trigger(uint32_t now, Ts... args)
|
void trigger(uint32_t now, Ts... args)
|
||||||
|
@ -50,7 +49,7 @@ namespace ratgdo {
|
||||||
this->callbacks_.clear();
|
this->callbacks_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_expired(uint32_t now) const
|
bool is_expired(uint32_t now) const
|
||||||
{
|
{
|
||||||
bool expired = true;
|
bool expired = true;
|
||||||
for (auto& cb : this->callbacks_) {
|
for (auto& cb : this->callbacks_) {
|
||||||
|
@ -61,7 +60,7 @@ namespace ratgdo {
|
||||||
return expired;
|
return expired;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
this->callbacks_.clear();
|
this->callbacks_.clear();
|
||||||
}
|
}
|
||||||
|
@ -70,6 +69,5 @@ namespace ratgdo {
|
||||||
std::vector<std::pair<uint32_t, std::function<void(Ts...)>>> callbacks_;
|
std::vector<std::pair<uint32_t, std::function<void(Ts...)>>> callbacks_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace ratgdo
|
} // namespace ratgdo
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|
|
@ -198,7 +198,7 @@ namespace ratgdo {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (learn_state == LearnState::INACTIVE) {
|
if (learn_state == LearnState::INACTIVE) {
|
||||||
defer([=](){ this->query_paired_devices(); });
|
defer([=]() { this->query_paired_devices(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
this->learn_state = learn_state;
|
this->learn_state = learn_state;
|
||||||
|
@ -249,7 +249,7 @@ namespace ratgdo {
|
||||||
this->motion_state = MotionState::CLEAR;
|
this->motion_state = MotionState::CLEAR;
|
||||||
});
|
});
|
||||||
if (*this->light_state == LightState::OFF) {
|
if (*this->light_state == LightState::OFF) {
|
||||||
defer([=]() {this->query_status(); });
|
defer([=]() { this->query_status(); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue