Browse Source

relay: scheduling from system timer does not work

also queue fallback check instead of resolving it in the timer
resolve #2571
pull/2575/head
Maxim Prokhorov 1 year ago
parent
commit
f387b864da
1 changed files with 10 additions and 4 deletions
  1. +10
    -4
      code/espurna/wifi.cpp

+ 10
- 4
code/espurna/wifi.cpp View File

@ -2116,7 +2116,11 @@ void remove() {
void check(); void check();
void schedule() { void schedule() {
internal::timer.once(internal::timeout, check);
internal::timer.repeat(
internal::timeout,
[]() {
wifi::action(wifi::Action::AccessPointFallbackCheck);
});
} }
void check() { void check() {
@ -2124,12 +2128,9 @@ void check() {
&& wifi::sta::connected() && wifi::sta::connected()
&& !wifi::ap::stations()) && !wifi::ap::stations())
{ {
remove();
wifi::action(wifi::Action::AccessPointStop); wifi::action(wifi::Action::AccessPointStop);
return; return;
} }
schedule();
} }
} // namespace fallback } // namespace fallback
@ -2320,6 +2321,11 @@ void wifi(::terminal::CommandContext&& ctx) {
wifi::debug::authmode(current.authmode).c_str(), wifi::debug::authmode(current.authmode).c_str(),
current.ssid.c_str(), current.ssid.c_str(),
current.passphrase.c_str()); current.passphrase.c_str());
if (wifi::ap::fallback::enabled() && wifi::ap::fallback::internal::timer) {
ctx.output.printf_P(PSTR("fallback check every %u ms\n"),
wifi::ap::fallback::build::Timeout.count());
}
} }
if (mode & OpmodeSta) { if (mode & OpmodeSta) {


Loading…
Cancel
Save