mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-17 18:52:07 +02:00
Update board support handle and fix connect timeout handle.
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
#include "AgWiFiConnector.h"
|
||||
#include "Libraries/WiFiManager/WiFiManager.h"
|
||||
|
||||
#define WIFI_CONNECT_COUNTDOWN_MAX 180
|
||||
// FIXME Just for test
|
||||
#define WIFI_CONNECT_COUNTDOWN_MAX 60
|
||||
#define WIFI_HOTSPOT_PASSWORD_DEFAULT "cleanair"
|
||||
|
||||
#define WIFI() ((WiFiManager *)(this->wifi))
|
||||
@ -48,8 +49,8 @@ bool WifiConnector::connect(void) {
|
||||
WIFI()->setAPCallback([this](WiFiManager *obj) { _wifiApCallback(); });
|
||||
WIFI()->setSaveConfigCallback([this]() { _wifiSaveConfig(); });
|
||||
WIFI()->setSaveParamsCallback([this]() { _wifiSaveParamCallback(); });
|
||||
WIFI()->setConfigPortalTimeoutCallback([this]() {});
|
||||
if (ag->isOne() || (ag->getBoardType() == DIY_PRO_INDOOR_V4_2)) {
|
||||
WIFI()->setConfigPortalTimeoutCallback([this]() {_wifiTimeoutCallback();});
|
||||
if (ag->isOne() || (ag->isPro4_2())) {
|
||||
disp.setText("Connecting to", "WiFi", "...");
|
||||
} else {
|
||||
logInfo("Connecting to WiFi...");
|
||||
@ -142,7 +143,7 @@ bool WifiConnector::connect(void) {
|
||||
/** Show display wifi connect result failed */
|
||||
if (WiFi.isConnected() == false) {
|
||||
sm.handleLeds(AgStateMachineWiFiManagerConnectFailed);
|
||||
if (ag->isOne() || ag->getBoardType() == DIY_PRO_INDOOR_V4_2) {
|
||||
if (ag->isOne() || ag->isPro4_2()) {
|
||||
sm.displayHandle(AgStateMachineWiFiManagerConnectFailed);
|
||||
}
|
||||
delay(6000);
|
||||
@ -247,7 +248,7 @@ void WifiConnector::_wifiProcess() {
|
||||
if (WiFi.isConnected() == false) {
|
||||
/** Display countdown */
|
||||
uint32_t ms;
|
||||
if (ag->isOne() || (ag->getBoardType() == DIY_PRO_INDOOR_V4_2)) {
|
||||
if (ag->isOne() || (ag->isPro4_2())) {
|
||||
ms = (uint32_t)(millis() - dispPeriod);
|
||||
if (ms >= 1000) {
|
||||
dispPeriod = millis();
|
||||
|
Reference in New Issue
Block a user