mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-06-28 17:20:57 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
28096e9faf | |||
682378a47c | |||
a1861be7b7 | |||
99ddd24432 | |||
03e2afbf54 |
@ -327,9 +327,7 @@ static void factoryConfigReset(void) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/** Reset WIFI */
|
/** Reset WIFI */
|
||||||
// WiFi.enableSTA(true); // Incase offline mode
|
WiFi.disconnect(true, true);
|
||||||
// WiFi.disconnect(true, true);
|
|
||||||
wifiConnector.reset();
|
|
||||||
|
|
||||||
/** Reset local config */
|
/** Reset local config */
|
||||||
configuration.reset();
|
configuration.reset();
|
||||||
|
@ -423,8 +423,7 @@ static void factoryConfigReset(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Reset WIFI */
|
/** Reset WIFI */
|
||||||
Serial.println("Set wifi connect to 'airgradient' as default");
|
WiFi.disconnect(true, true);
|
||||||
WiFi.begin("airgradient", "cleanair");
|
|
||||||
|
|
||||||
/** Reset local config */
|
/** Reset local config */
|
||||||
configuration.reset();
|
configuration.reset();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=AirGradient Air Quality Sensor
|
name=AirGradient Air Quality Sensor
|
||||||
version=3.1.6
|
version=3.1.7
|
||||||
author=AirGradient <support@airgradient.com>
|
author=AirGradient <support@airgradient.com>
|
||||||
maintainer=AirGradient <support@airgradient.com>
|
maintainer=AirGradient <support@airgradient.com>
|
||||||
sentence=ESP32-C3 / ESP8266 library for air quality monitor measuring PM, CO2, Temperature, TVOC and Humidity with OLED display.
|
sentence=ESP32-C3 / ESP8266 library for air quality monitor measuring PM, CO2, Temperature, TVOC and Humidity with OLED display.
|
||||||
|
@ -41,6 +41,28 @@ bool WifiConnector::connect(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WiFi.begin();
|
||||||
|
String wifiSSID = WIFI()->getWiFiSSID(true);
|
||||||
|
if (wifiSSID.isEmpty()) {
|
||||||
|
logInfo("Connected WiFi is empty, connect to default wifi \"" +
|
||||||
|
String(this->defaultSsid) + String("\""));
|
||||||
|
|
||||||
|
/** Set wifi connect */
|
||||||
|
WiFi.begin(this->defaultSsid, this->defaultPassword);
|
||||||
|
|
||||||
|
/** Wait for wifi connect to AP */
|
||||||
|
int count = 0;
|
||||||
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
delay(1000);
|
||||||
|
count++;
|
||||||
|
if (count >= 15) {
|
||||||
|
logError("Try connect to default wifi \"" + String(this->defaultSsid) +
|
||||||
|
String("\" failed"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WIFI()->setConfigPortalBlocking(false);
|
WIFI()->setConfigPortalBlocking(false);
|
||||||
WIFI()->setConnectTimeout(15);
|
WIFI()->setConnectTimeout(15);
|
||||||
WIFI()->setTimeout(WIFI_CONNECT_COUNTDOWN_MAX);
|
WIFI()->setTimeout(WIFI_CONNECT_COUNTDOWN_MAX);
|
||||||
@ -383,3 +405,11 @@ bool WifiConnector::hasConfigurated(void) {
|
|||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool WifiConnector::isConfigurePorttalTimeout(void) { return connectorTimeout; }
|
bool WifiConnector::isConfigurePorttalTimeout(void) { return connectorTimeout; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set wifi connect to default WiFi
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void WifiConnector::setDefault(void) {
|
||||||
|
WiFi.begin("airgradient", "cleanair");
|
||||||
|
}
|
||||||
|
@ -46,6 +46,10 @@ public:
|
|||||||
String localIpStr(void);
|
String localIpStr(void);
|
||||||
bool hasConfigurated(void);
|
bool hasConfigurated(void);
|
||||||
bool isConfigurePorttalTimeout(void);
|
bool isConfigurePorttalTimeout(void);
|
||||||
|
|
||||||
|
const char* defaultSsid = "airgradient";
|
||||||
|
const char* defaultPassword = "cleanair";
|
||||||
|
void setDefault(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /** _AG_WIFI_CONNECTOR_H_ */
|
#endif /** _AG_WIFI_CONNECTOR_H_ */
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "Main/utils.h"
|
#include "Main/utils.h"
|
||||||
|
|
||||||
#ifndef GIT_VERSION
|
#ifndef GIT_VERSION
|
||||||
#define GIT_VERSION "3.1.6-snap"
|
#define GIT_VERSION "3.1.7-snap"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user