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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 12 deletions

View File

@ -83,20 +83,22 @@ def _format_framework_arduino_version(ver: cv.Version) -> str:
# The default/recommended arduino framework version # The default/recommended arduino framework version
# - https://github.com/esp8266/Arduino/releases # - https://github.com/esp8266/Arduino/releases
# - https://api.registry.platformio.org/v3/packages/platformio/tool/framework-arduinoespressif8266 # - https://api.registry.platformio.org/v3/packages/platformio/tool/framework-arduinoespressif8266
RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(3, 0, 2) RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(3, 1, 2)
# The platformio/espressif8266 version to use for arduino 2 framework versions # The platformio/espressif8266 version to use for arduino 2 framework versions
# - https://github.com/platformio/platform-espressif8266/releases # - https://github.com/platformio/platform-espressif8266/releases
# - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif8266 # - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif8266
ARDUINO_2_PLATFORM_VERSION = cv.Version(2, 6, 3) ARDUINO_2_PLATFORM_VERSION = cv.Version(2, 6, 3)
# for arduino 3 framework versions # for arduino 3 framework versions
ARDUINO_3_PLATFORM_VERSION = cv.Version(3, 2, 0) ARDUINO_3_PLATFORM_VERSION = cv.Version(3, 2, 0)
# for arduino 4 framework versions
ARDUINO_4_PLATFORM_VERSION = cv.Version(4, 2, 1)
def _arduino_check_versions(value): def _arduino_check_versions(value):
value = value.copy() value = value.copy()
lookups = { lookups = {
"dev": (cv.Version(3, 0, 2), "https://github.com/esp8266/Arduino.git"), "dev": (cv.Version(3, 1, 2), "https://github.com/esp8266/Arduino.git"),
"latest": (cv.Version(3, 0, 2), None), "latest": (cv.Version(3, 1, 2), None),
"recommended": (RECOMMENDED_ARDUINO_FRAMEWORK_VERSION, None), "recommended": (RECOMMENDED_ARDUINO_FRAMEWORK_VERSION, None),
} }
@ -116,7 +118,9 @@ def _arduino_check_versions(value):
platform_version = value.get(CONF_PLATFORM_VERSION) platform_version = value.get(CONF_PLATFORM_VERSION)
if platform_version is None: if platform_version is None:
if version >= cv.Version(3, 0, 0): if version >= cv.Version(3, 1, 0):
platform_version = _parse_platform_version(str(ARDUINO_4_PLATFORM_VERSION))
elif version >= cv.Version(3, 0, 0):
platform_version = _parse_platform_version(str(ARDUINO_3_PLATFORM_VERSION)) platform_version = _parse_platform_version(str(ARDUINO_3_PLATFORM_VERSION))
elif version >= cv.Version(2, 5, 0): elif version >= cv.Version(2, 5, 0):
platform_version = _parse_platform_version(str(ARDUINO_2_PLATFORM_VERSION)) platform_version = _parse_platform_version(str(ARDUINO_2_PLATFORM_VERSION))

View File

@ -187,11 +187,7 @@ void MQTTClientComponent::start_dnslookup_() {
default: default:
case ERR_ARG: { case ERR_ARG: {
// error // error
#if defined(USE_ESP8266)
ESP_LOGW(TAG, "Error resolving MQTT broker IP address: %ld", err);
#else
ESP_LOGW(TAG, "Error resolving MQTT broker IP address: %d", err); ESP_LOGW(TAG, "Error resolving MQTT broker IP address: %d", err);
#endif
break; break;
} }
} }

View File

@ -21,10 +21,14 @@ extern "C" {
#include <AddrList.h> #include <AddrList.h>
#if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0) #if USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0)
#include "LwipDhcpServer.h" #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(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_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) #define wifi_softap_set_dhcps_offer_option(offer, mode) dhcpSoftAP.set_dhcps_offer_option(offer, mode)
#endif #endif
#endif
} }
#include "esphome/core/helpers.h" #include "esphome/core/helpers.h"
@ -721,7 +725,7 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
return false; 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); dhcpSoftAP.begin(&info);
#endif #endif
@ -745,12 +749,16 @@ bool WiFiComponent::wifi_ap_ip_config_(optional<ManualIP> manual_ip) {
return false; 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; uint8_t mode = 1;
// bit0, 1 enables router information from ESP8266 SoftAP DHCP server. // bit0, 1 enables router information from ESP8266 SoftAP DHCP server.
if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) { if (!wifi_softap_set_dhcps_offer_option(OFFER_ROUTER, &mode)) {
ESP_LOGV(TAG, "wifi_softap_set_dhcps_offer_option failed!"); ESP_LOGV(TAG, "wifi_softap_set_dhcps_offer_option failed!");
return false; return false;
} }
#endif
if (!wifi_softap_dhcps_start()) { if (!wifi_softap_dhcps_start()) {
ESP_LOGV(TAG, "Starting SoftAP DHCPS failed!"); ESP_LOGV(TAG, "Starting SoftAP DHCPS failed!");

View File

@ -98,7 +98,7 @@
// ESP8266-specific feature flags // ESP8266-specific feature flags
#ifdef USE_ESP8266 #ifdef USE_ESP8266
#define USE_ADC_SENSOR_VCC #define USE_ADC_SENSOR_VCC
#define USE_ARDUINO_VERSION_CODE VERSION_CODE(3, 0, 2) #define USE_ARDUINO_VERSION_CODE VERSION_CODE(3, 1, 2)
#define USE_ESP8266_PREFERENCES_FLASH #define USE_ESP8266_PREFERENCES_FLASH
#define USE_HTTP_REQUEST_ESP8266_HTTPS #define USE_HTTP_REQUEST_ESP8266_HTTPS
#define USE_SOCKET_IMPL_LWIP_TCP #define USE_SOCKET_IMPL_LWIP_TCP

View File

@ -80,9 +80,9 @@ build_flags =
; This are common settings for the ESP8266 using Arduino. ; This are common settings for the ESP8266 using Arduino.
[common:esp8266-arduino] [common:esp8266-arduino]
extends = common:arduino extends = common:arduino
platform = platformio/espressif8266@3.2.0 platform = platformio/espressif8266@4.2.1
platform_packages = platform_packages =
platformio/framework-arduinoespressif8266@~3.30002.0 platformio/framework-arduinoespressif8266@~3.30102.0
framework = arduino framework = arduino
lib_deps = lib_deps =