From 4ade4526a1ec85b0f5328da98db0b7ed994543ba Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Thu, 6 Jun 2019 13:58:56 -0500 Subject: [PATCH] Added default timeout to WPS mode, typically 60 seconds which is set by WIFI_CONNECT_TIMEOUT in general.h --- src/JustWifi.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/JustWifi.cpp b/src/JustWifi.cpp index 54021d9..d3fdb10 100644 --- a/src/JustWifi.cpp +++ b/src/JustWifi.cpp @@ -488,6 +488,8 @@ void JustWifi::_machine() { case STATE_WPS_START: + _timeout = millis(); + _doCallback(MESSAGE_WPS_START); _disable(); @@ -527,6 +529,10 @@ void JustWifi::_machine() { case STATE_WPS_ONGOING: if (5 == _jw_wps_status) { // Still ongoing + // Check timeout + if (millis() - _timeout > _connect_timeout) { + _state = STATE_WPS_FAILED; + } } else if (WPS_CB_ST_SUCCESS == _jw_wps_status) { _state = STATE_WPS_SUCCESS; } else {