Skip to content

Commit b8ccfc4

Browse files
committed
Make Soft AP build against Arduino SDK 3.0.0
It seems that the global dhcpSoftAP is used to encapsulate some of the DHCP functionality. Make use of the new API. See upstream change: esp8266/Arduino#6680
1 parent ccff22a commit b8ccfc4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

esphome/components/wifi/wifi_component_esp8266.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include <wpa2_enterprise.h>
1111
#endif
1212

13+
#ifdef WIFI_IS_OFF_AT_BOOT // Identifies ESP8266 Arduino 3.0.0
14+
#define ARDUINO_ESP8266_RELEASE_3
15+
#endif
16+
1317
extern "C" {
1418
#include "lwip/err.h"
1519
#include "lwip/dns.h"
@@ -18,8 +22,15 @@ extern "C" {
1822
#if LWIP_IPV6
1923
#include "lwip/netif.h" // struct netif
2024
#endif
25+
#ifdef ARDUINO_ESP8266_RELEASE_3
26+
#include "LwipDhcpServer.h"
27+
#define wifi_softap_set_dhcps_lease(lease) dhcpSoftAP.set_dhcps_lease(lease)
28+
#define wifi_softap_set_dhcps_lease_time(time) dhcpSoftAP.set_dhcps_lease_time(time)
29+
#define wifi_softap_set_dhcps_offer_option(offer, mode) dhcpSoftAP.set_dhcps_offer_option(offer, mode)
30+
#endif
2131
}
2232

33+
2334
#include "esphome/core/helpers.h"
2435
#include "esphome/core/log.h"
2536
#include "esphome/core/esphal.h"
@@ -649,6 +660,10 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
649660
return false;
650661
}
651662

663+
#ifdef ARDUINO_ESP8266_RELEASE_3
664+
dhcpSoftAP.begin(&info);
665+
#endif
666+
652667
struct dhcps_lease lease {};
653668
IPAddress start_address = info.ip.addr;
654669
start_address[3] += 99;

0 commit comments

Comments
 (0)