1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 00:02:21 +01:00

Bump ESP8266 Arduino versions (#5359)

This commit is contained in:
Jimmy Hedman
2024-03-20 09:16:10 +01:00
committed by GitHub
parent b12ccd460b
commit 7d9fc3ceaa
5 changed files with 20 additions and 12 deletions

View File

@@ -21,10 +21,14 @@ extern "C" {
#include <AddrList.h>
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
#include "LwipDhcpServer.h"
#if USE_ARDUINO_VERSION_CODE < VERSION_CODE(3, 1, 0)
#include <ESP8266WiFi.h>
#include "ESP8266WiFiAP.h"
#define wifi_softap_set_dhcps_lease(lease) dhcpSoftAP.set_dhcps_lease(lease)
#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
#endif
}
#include "esphome/core/helpers.h"
@@ -721,7 +725,7 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
return false;
}
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0) && USE_ARDUINO_VERSION_CODE < VERSION_CODE(3, 1, 0)
dhcpSoftAP.begin(&info);
#endif
@@ -745,12 +749,16 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
return false;
}
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 1, 0)
ESP8266WiFiClass::softAPDhcpServer().setRouter(true); // send ROUTER option with netif's gateway IP
#else
uint8_t mode = 1;
// bit0, 1 enables router information from ESP8266 SoftAP DHCP server.
if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
ESP_LOGV(TAG, "wifi_softap_set_dhcps_offer_option failed!");
return false;
}
#endif
if (!wifi_softap_dhcps_start()) {
ESP_LOGV(TAG, "Starting SoftAP DHCPS failed!");