WLED_CONNECTED macro
This commit is contained in:
parent
d4c921ea2e
commit
733996772b
@ -99,7 +99,7 @@
|
||||
|
||||
|
||||
//version code in format yymmddb (b = daily build)
|
||||
#define VERSION 1910174
|
||||
#define VERSION 1910181
|
||||
char versionString[] = "0.8.5";
|
||||
|
||||
|
||||
@ -433,6 +433,8 @@ E131* e131;
|
||||
//led fx library object
|
||||
WS2812FX strip = WS2812FX();
|
||||
|
||||
#define WLED_CONNECTED (WiFi.status() == WL_CONNECTED)
|
||||
|
||||
//debug macros
|
||||
#ifdef WLED_DEBUG
|
||||
#define DEBUG_PRINT(x) Serial.print (x)
|
||||
@ -504,6 +506,7 @@ void setup() {
|
||||
|
||||
//main program loop
|
||||
void loop() {
|
||||
handleConnection();
|
||||
handleSerial();
|
||||
handleNotifications();
|
||||
handleTransitions();
|
||||
|
@ -214,7 +214,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
utcOffsetSecs = request->arg("UO").toInt();
|
||||
|
||||
//start ntp if not already connected
|
||||
if (ntpEnabled && WiFi.status() == WL_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort);
|
||||
if (ntpEnabled && WLED_CONNECTED && !ntpConnected) ntpConnected = ntpUdp.begin(ntpLocalPort);
|
||||
|
||||
if (request->hasArg("OL")){
|
||||
overlayDefault = request->arg("OL").toInt();
|
||||
|
@ -63,7 +63,7 @@ void wledInit()
|
||||
udpConnected = notifierUdp.begin(udpPort);
|
||||
if (udpConnected && udpRgbPort != udpPort) udpRgbConnected = rgbUdp.begin(udpRgbPort);
|
||||
}
|
||||
if (ntpEnabled && WiFi.status() == WL_CONNECTED)
|
||||
if (ntpEnabled && WLED_CONNECTED)
|
||||
ntpConnected = ntpUdp.begin(ntpLocalPort);
|
||||
|
||||
//start captive portal if AP active
|
||||
@ -227,7 +227,7 @@ void initCon()
|
||||
handleOverlays();
|
||||
if (briT) strip.service();
|
||||
if (millis()-lastTry > 499) {
|
||||
con = (WiFi.status() == WL_CONNECTED);
|
||||
con = WLED_CONNECTED;
|
||||
lastTry = millis();
|
||||
DEBUG_PRINTLN("C_NC");
|
||||
if (!recoveryAPDisabled && fail_count > apWaitTimeSecs*2)
|
||||
|
@ -87,7 +87,7 @@ void arlsLock(uint32_t timeoutMs)
|
||||
|
||||
|
||||
void initE131(){
|
||||
if (WiFi.status() == WL_CONNECTED && e131Enabled)
|
||||
if (WLED_CONNECTED && e131Enabled)
|
||||
{
|
||||
e131 = new E131();
|
||||
e131->begin((e131Multicast) ? E131_MULTICAST : E131_UNICAST , e131Universe);
|
||||
|
@ -56,7 +56,7 @@ Timezone* timezones[] = {&tzUTC, &tzUK, &tzEUCentral, &tzEUEastern, &tzUSEastern
|
||||
|
||||
void handleNetworkTime()
|
||||
{
|
||||
if (ntpEnabled && ntpConnected && millis() - ntpLastSyncTime > 50000000L && WiFi.status() == WL_CONNECTED)
|
||||
if (ntpEnabled && ntpConnected && millis() - ntpLastSyncTime > 50000000L && WLED_CONNECTED)
|
||||
{
|
||||
if (millis() - ntpPacketSentTime > 10000)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ void onAlexaChange(EspalexaDevice* dev);
|
||||
|
||||
void alexaInit()
|
||||
{
|
||||
if (alexaEnabled && WiFi.status() == WL_CONNECTED)
|
||||
if (alexaEnabled && WLED_CONNECTED)
|
||||
{
|
||||
if (espalexaDevice == nullptr) //only init once
|
||||
{
|
||||
@ -31,7 +31,7 @@ void alexaInit()
|
||||
|
||||
void handleAlexa()
|
||||
{
|
||||
if (!alexaEnabled || WiFi.status() != WL_CONNECTED) return;
|
||||
if (!alexaEnabled || !WLED_CONNECTED) return;
|
||||
espalexa.loop();
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#ifndef WLED_DISABLE_HUESYNC
|
||||
void handleHue()
|
||||
{
|
||||
if (hueClient != nullptr && millis() - hueLastRequestSent > huePollIntervalMs && WiFi.status() == WL_CONNECTED)
|
||||
if (hueClient != nullptr && millis() - hueLastRequestSent > huePollIntervalMs && WLED_CONNECTED)
|
||||
{
|
||||
hueLastRequestSent = millis();
|
||||
if (huePollingEnabled)
|
||||
@ -29,7 +29,7 @@ void handleHue()
|
||||
|
||||
void reconnectHue()
|
||||
{
|
||||
if (WiFi.status() != WL_CONNECTED || !huePollingEnabled) return;
|
||||
if (!WLED_CONNECTED || !huePollingEnabled) return;
|
||||
DEBUG_PRINTLN("Hue reconnect");
|
||||
if (hueClient == nullptr) {
|
||||
hueClient = new AsyncClient();
|
||||
|
@ -8,7 +8,7 @@ byte blSat = 255;
|
||||
void initBlynk(const char* auth)
|
||||
{
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
if (WiFi.status() != WL_CONNECTED) return;
|
||||
if (!WLED_CONNECTED) return;
|
||||
blynkEnabled = (auth[0] != 0);
|
||||
if (blynkEnabled) Blynk.config(auth);
|
||||
#endif
|
||||
@ -17,7 +17,7 @@ void initBlynk(const char* auth)
|
||||
void handleBlynk()
|
||||
{
|
||||
#ifndef WLED_DISABLE_BLYNK
|
||||
if (WiFi.status() == WL_CONNECTED && blynkEnabled)
|
||||
if (WLED_CONNECTED && blynkEnabled)
|
||||
Blynk.run();
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user