From 82927ffa66646eae38ce623d40764230c1b4487a Mon Sep 17 00:00:00 2001 From: vidplace7 Date: Sun, 15 Jan 2023 19:48:44 -0500 Subject: [PATCH] Update ESP8266WiFi for Arduino 3.1.0+ Behaviour changed in upstream "Initialize SoftAP DhcpServer object on demand" https://github.com/esp8266/Arduino/pull/8546 --- esphome/components/wifi/wifi_component_esp8266.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/esphome/components/wifi/wifi_component_esp8266.cpp b/esphome/components/wifi/wifi_component_esp8266.cpp index de4253fe41eb..b0d886c32977 100644 --- a/esphome/components/wifi/wifi_component_esp8266.cpp +++ b/esphome/components/wifi/wifi_component_esp8266.cpp @@ -26,6 +26,12 @@ extern "C" { #define wifi_softap_set_dhcps_lease_time(time) dhcpSoftAP.set_dhcps_lease_time(time) #define wifi_softap_set_dhcps_offer_option(offer, mode) dhcpSoftAP.set_dhcps_offer_option(offer, mode) #endif +#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 1, 0) +auto &dhcpServer = WiFi.softAPDhcpServer(); +#define wifi_softap_set_dhcps_lease(lease) dhcpServer.set_dhcps_lease(lease) +#define wifi_softap_set_dhcps_lease_time(time) dhcpServer.set_dhcps_lease_time(time) +#define wifi_softap_set_dhcps_offer_option(offer, mode) dhcpServer.set_dhcps_offer_option(offer, mode) +#endif } #include "esphome/core/helpers.h"