diff --git a/platformio.ini b/platformio.ini index 48b23c8ef..00a5e7334 100755 --- a/platformio.ini +++ b/platformio.ini @@ -117,7 +117,7 @@ build_flags = ${esp82xx_defaults.build_flags} ; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH ; lwIP 2 - Higher Bandwitdh Low Memory no Features ; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH -; lwIP 2 - Higher Bandwitdh no Features +; lwIP 2 - Higher Bandwidth no Features (Tasmota default) -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH ; VTABLES in Flash (default) -DVTABLES_IN_FLASH @@ -133,6 +133,44 @@ build_flags = ${esp82xx_defaults.build_flags} ; -fexceptions ; -lstdc++-exc +[core_stage_ipv6] +; *** Esp8266 core for Arduino version latest beta +platform = https://github.com/platformio/platform-espressif8266.git#feature/stage +build_flags = ${esp82xx_defaults.build_flags} + -Wl,-Teagle.flash.1m.ld +; Code optimization see https://github.com/esp8266/Arduino/issues/5790#issuecomment-475672473 + -O2 + -DBEARSSL_SSL_BASIC +; nonos-sdk 22y + -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22y +; nonos-sdk 22x +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x +; nonos-sdk-pre-v3 +; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3 +; lwIP 1.4 +; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH +; lwIP 2 - Low Memory +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY +; lwIP 2 - Higher Bandwidth +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH +; lwIP 2 - Higher Bandwitdh Low Memory no Features +; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH +; lwIP 2 - Higher Bandwidth IPv6 + -DPIO_FRAMEWORK_ARDUINO_LWIP2_IPV6_HIGHER_BANDWIDTH +; VTABLES in Flash (default) + -DVTABLES_IN_FLASH +; VTABLES in Heap +; -DVTABLES_IN_DRAM +; VTABLES in IRAM +; -DVTABLES_IN_IRAM +; enable one option set -> No exception recommended +; No exception code in firmware + -fno-exceptions + -lstdc++ +; Exception code in firmware /needs much space! 90k +; -fexceptions +; -lstdc++-exc + [core_pre] ; *** Arduino Esp8266 core pre 2.6.x for Tasmota (mqtt reconnects fixed) platform = https://github.com/Jason2866/platform-espressif8266.git#Tasmota @@ -180,6 +218,8 @@ build_flags = ${esp82xx_defaults.build_flags} ;build_flags = ${core_2_5_2.build_flags} ;platform = ${core_stage.platform} ;build_flags = ${core_stage.build_flags} +;platform = ${core_stage_ipv6.platform} +;build_flags = ${core_stage_ipv6.build_flags} platform = ${core_pre.platform} build_flags = ${core_pre.build_flags} diff --git a/sonoff/support_wifi.ino b/sonoff/support_wifi.ino index e528e51ea..fc2bc8056 100644 --- a/sonoff/support_wifi.ino +++ b/sonoff/support_wifi.ino @@ -33,6 +33,9 @@ const uint8_t WIFI_CHECK_SEC = 20; // seconds const uint8_t WIFI_RETRY_OFFSET_SEC = 20; // seconds #include // Wifi, MQTT, Ota, WifiManager +#if LWIP_IPV6 +#include // IPv6 DualStack +#endif struct WIFI { uint32_t last_event = 0; // Last wifi connection event @@ -235,6 +238,24 @@ void WifiBegin(uint8_t flag, uint8_t channel) } AddLog_P2(LOG_LEVEL_INFO, PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s " D_IN_MODE " 11%c " D_AS " %s..."), Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active], kWifiPhyMode[WiFi.getPhyMode() & 0x3], my_hostname); + +#if LWIP_IPV6 + for (bool configured = false; !configured;) { + uint16_t cfgcnt=0; + for (auto addr : addrList) + { + if ((configured = !addr.isLocal() && addr.isV6()) || cfgcnt==30) break; // IPv6 is mandatory but stop after 15 seconds + delay(500); // Loop until real IPv6 address is aquired or too many tries failed + cfgcnt++; + } + } + for (auto a : addrList) { + if(!a.isLocal() && !a.isLegacy()) + { + AddLog_P2(LOG_LEVEL_INFO, PSTR("WIFi: Got IPv6 global address %s"),a.toString().c_str()); + } + } +#endif } void WifiBeginAfterScan()