Test fix for WDT reset issue

This commit is contained in:
Marius Muja 2024-01-22 16:08:10 -08:00
parent 9ec34310d2
commit 8fe0a53764
2 changed files with 13 additions and 0 deletions

View File

@ -602,6 +602,16 @@ namespace ratgdo {
counter.value.rolling_code_counter.value->subscribe([=](uint32_t state) { defer("rolling_code_counter", [=] { f(state); }); });
}
}
void RATGDOComponent::defer(std::function<void()> &&f) {
App.scheduler.set_timeout(this, "", 0, [=](){ f(); App.feed_wdt();});
}
void RATGDOComponent::defer(const std::string &name, std::function<void()> &&f) {
App.scheduler.set_timeout(this, name, 0, [=](){ f(); App.feed_wdt();});
}
void RATGDOComponent::subscribe_opening_duration(std::function<void(float)>&& f)
{
this->opening_duration.subscribe([=](float state) { defer("opening_duration", [=] { f(state); }); });

View File

@ -166,6 +166,9 @@ namespace ratgdo {
void subscribe_sync_failed(std::function<void(bool)>&& f);
void subscribe_learn_state(std::function<void(LearnState)>&& f);
void defer(std::function<void()> &&f);
void defer(const std::string &name, std::function<void()> &&f);
protected:
RATGDOStore isr_store_ {};
protocol::Protocol* protocol_;