Skip to content

Commit 949d42f

Browse files
committed
fix WLED_QEMU build
- fix for mis-placed #ifndef WLED_QEMU - disable AP code when building for WLED_QEMU - WLED_CONNECTED for WLED_QEMU: do not check if wifi active/connected - disable MDNS for WLED_QEMU -minor cleanup
1 parent dafd718 commit 949d42f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ build_flags = ${esp32_4MB_V4_M_base.build_flags}
18691869
; -D WLED_STATIC_IP_DEFAULT_2=0
18701870
; -D WLED_STATIC_IP_DEFAULT_3=2
18711871
; -D WLED_STATIC_IP_DEFAULT_4=15
1872-
-D WLED_DISABLE_WIFI ;; experimental - no wifi AP mode
1872+
-D MDNS_NAME=\"\" ;; disable MDNS
18731873
-D WLED_DISABLE_INFRARED
18741874
-D BTNPIN=-1 -D RLYPIN=1 -D IRPIN=-1 ;; disable all extra pins
18751875
-D SR_DMTYPE=254 -D AUDIOPIN=-1 ;; set AR into "received only" mode

wled00/wled.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ void WLED::initAP(bool resetAP)
959959
if (apBehavior == AP_BEHAVIOR_BUTTON_ONLY && !resetAP)
960960
return;
961961

962+
#if !defined(WLED_QEMU) // QEMU does not support wifi AP mode
962963
if (resetAP) {
963964
WLED_SET_AP_SSID();
964965
strcpy_P(apPass, PSTR(WLED_AP_PASS));
@@ -991,6 +992,7 @@ void WLED::initAP(bool resetAP)
991992
dnsServer.start(53, "*", WiFi.softAPIP());
992993
}
993994
apActive = true;
995+
#endif // WLED_QEMU
994996
}
995997

996998
bool WLED::initEthernet()
@@ -1359,8 +1361,8 @@ void WLED::handleConnection()
13591361
}
13601362
#endif
13611363

1362-
#ifndef WLED_QEMU
13631364
byte stac = 0;
1365+
#ifndef WLED_QEMU
13641366
if (apActive) {
13651367
#ifdef ESP8266
13661368
stac = wifi_softap_get_station_num();

wled00/wled.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ WLED_GLOBAL char cmDNS[33] _INIT(MDNS_NAME); // mDNS addre
350350
WLED_GLOBAL char apSSID[33] _INIT(""); // AP off by default (unless setup)
351351
WLED_GLOBAL byte apChannel _INIT(6); // 2.4GHz WiFi AP channel (1-13)
352352
WLED_GLOBAL byte apHide _INIT(0); // hidden AP SSID
353-
#ifndef WLED_DISABLE_WIFI
354-
WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BOOT_NO_CONN); // access point opens when no connection after boot by default
355-
#else
353+
#ifdef WLED_QEMU
356354
WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BUTTON_ONLY); // access point opens when button0 pressed for at least 6 seconds
355+
#else
356+
WLED_GLOBAL byte apBehavior _INIT(AP_BEHAVIOR_BOOT_NO_CONN); // access point opens when no connection after boot by default
357357
#endif
358358
WLED_GLOBAL IPAddress staticIP _INIT_N((( 0, 0, 0, 0))); // static IP of ESP
359359
WLED_GLOBAL IPAddress staticGateway _INIT_N((( 0, 0, 0, 0))); // gateway (router) IP
@@ -895,7 +895,11 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0);
895895
#endif
896896

897897
#ifdef ARDUINO_ARCH_ESP32
898+
#ifdef WLED_QEMU
899+
#define WLED_CONNECTED (ETH.localIP()[0] != 0) // QEMU does not have wifi
900+
#else
898901
#define WLED_CONNECTED (WiFi.status() == WL_CONNECTED || ETH.localIP()[0] != 0)
902+
#endif
899903
#else
900904
#define WLED_CONNECTED (WiFi.status() == WL_CONNECTED)
901905
#endif

0 commit comments

Comments
 (0)