sdk完善

This commit is contained in:
kerwincui
2022-08-03 15:47:44 +08:00
parent fc753c2898
commit 339e065031
5 changed files with 160 additions and 97 deletions

View File

@@ -10,6 +10,7 @@
#include "Auth.h"
#include "Apconfig.h"
long lastWifiConn; // 上次wifi连接时间
long lastMqttConn; // 上次mqtt连接时间
long lastPublishMonitor; // 上次发布监测数据时间
long lastPublishSimulateData; // 上次发布测试数据时间
@@ -19,6 +20,7 @@ long lastPublishSimulateData; // 上次发布测试数据时间
*/
void setup()
{
clearConfig();
// 初始化配置
initWumeiSmart();
@@ -32,7 +34,6 @@ void setup()
connectMqtt();
}
}
/**
@@ -65,13 +66,18 @@ void loop()
}
/*
* Wifi掉线重连
* Wifi掉线重连(非阻塞间隔10s)
*/
void wifiReconnectionClient()
{
long now = millis();
if (WiFi.status() != WL_CONNECTED)
{
connectWifi();
if (now - lastWifiConn > 10000)
{
lastWifiConn = now;
WiFi.reconnect();
}
}
}