diff --git a/esphome/components/sensor/filter.cpp b/esphome/components/sensor/filter.cpp index a2058f7d90..bbe47b43ec 100644 --- a/esphome/components/sensor/filter.cpp +++ b/esphome/components/sensor/filter.cpp @@ -237,7 +237,7 @@ optional FilterOutValueFilter::new_value(float value) { return value; } else { int8_t accuracy = this->parent_->get_accuracy_decimals(); - float accuracy_mult = pow10f(accuracy); + float accuracy_mult = powf(10.0f, accuracy); float rounded_filter_out = roundf(accuracy_mult * this->value_to_filter_out_); float rounded_value = roundf(accuracy_mult * value); if (rounded_filter_out == rounded_value) diff --git a/esphome/components/wifi/wifi_component_esp8266.cpp b/esphome/components/wifi/wifi_component_esp8266.cpp index 0425f58c28..2f6c32aec6 100644 --- a/esphome/components/wifi/wifi_component_esp8266.cpp +++ b/esphome/components/wifi/wifi_component_esp8266.cpp @@ -10,6 +10,10 @@ #include #endif +#ifdef WIFI_IS_OFF_AT_BOOT // Identifies ESP8266 Arduino 3.0.0 +#define ARDUINO_ESP8266_RELEASE_3 +#endif + extern "C" { #include "lwip/err.h" #include "lwip/dns.h" @@ -18,6 +22,12 @@ extern "C" { #if LWIP_IPV6 #include "lwip/netif.h" // struct netif #endif +#ifdef ARDUINO_ESP8266_RELEASE_3 +#include "LwipDhcpServer.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 } #include "esphome/core/helpers.h" @@ -649,6 +659,10 @@ bool WiFiComponent::wifi_ap_ip_config_(optional manual_ip) { return false; } +#ifdef ARDUINO_ESP8266_RELEASE_3 + dhcpSoftAP.begin(&info); +#endif + struct dhcps_lease lease {}; IPAddress start_address = info.ip.addr; start_address[3] += 99; diff --git a/esphome/const.py b/esphome/const.py index b50b60a204..bb20c606ce 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -28,6 +28,7 @@ ARDUINO_VERSION_ESP32 = { # See also https://github.com/platformio/platform-espressif8266/releases ARDUINO_VERSION_ESP8266 = { "dev": "https://github.com/platformio/platform-espressif8266.git", + "3.0.0": "platformio/espressif8266@3.0.0", "2.7.4": "platformio/espressif8266@2.6.2", "2.7.3": "platformio/espressif8266@2.6.1", "2.7.2": "platformio/espressif8266@2.6.0", diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index f78dcf3183..194ab08af3 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -105,7 +105,7 @@ std::string truncate_string(const std::string &s, size_t length) { } std::string value_accuracy_to_string(float value, int8_t accuracy_decimals) { - auto multiplier = float(pow10(accuracy_decimals)); + auto multiplier = float(powf(10.0f, accuracy_decimals)); float value_rounded = roundf(value * multiplier) / multiplier; char tmp[32]; // should be enough, but we should maybe improve this at some point. dtostrf(value_rounded, 0, uint8_t(std::max(0, int(accuracy_decimals))), tmp);