From 8dda0072f2e373e101ac5627cf61cccb59c58050 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Wed, 16 Oct 2019 14:22:43 +0300 Subject: [PATCH] WiFi: allow button action to also disable softAP (#1942) --- code/espurna/button.ino | 6 +++++- code/espurna/wifi.ino | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/code/espurna/button.ino b/code/espurna/button.ino index a44e667c..07045fdc 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -136,7 +136,11 @@ void buttonEvent(unsigned int id, unsigned char event) { } if (BUTTON_MODE_AP == action) { - wifiStartAP(); + if (wifiState() & WIFI_STATE_AP) { + wifiStartSTA(); + } else { + wifiStartAP(); + } } if (BUTTON_MODE_RESET == action) { diff --git a/code/espurna/wifi.ino b/code/espurna/wifi.ino index 49ac7f75..8341141c 100644 --- a/code/espurna/wifi.ino +++ b/code/espurna/wifi.ino @@ -700,6 +700,7 @@ void wifiReconnectCheck() { #if TELNET_SUPPORT if (telnetConnected()) connected = true; #endif + jw.enableSTA(true); jw.setReconnectTimeout(connected ? 0 : WIFI_RECONNECT_INTERVAL); }