diff --git a/esphome/components/as3935_spi/as3935_spi.h b/esphome/components/as3935_spi/as3935_spi.h index 073f5c09a4..e5422f9b37 100644 --- a/esphome/components/as3935_spi/as3935_spi.h +++ b/esphome/components/as3935_spi/as3935_spi.h @@ -3,8 +3,6 @@ #include "esphome/core/component.h" #include "esphome/components/as3935/as3935.h" #include "esphome/components/spi/spi.h" -#include "esphome/components/sensor/sensor.h" -#include "esphome/components/binary_sensor/binary_sensor.h" namespace esphome { namespace as3935_spi { diff --git a/esphome/components/ms8607/ms8607.cpp b/esphome/components/ms8607/ms8607.cpp index b985623b24..f8ea26bfd9 100644 --- a/esphome/components/ms8607/ms8607.cpp +++ b/esphome/components/ms8607/ms8607.cpp @@ -356,7 +356,7 @@ void MS8607Component::read_humidity_(float temperature_float) { // map 16 bit humidity value into range [-6%, 118%] float const humidity_partial = double(humidity) / (1 << 16); - float const humidity_percentage = lerp(humidity_partial, -6.0, 118.0); + float const humidity_percentage = std::lerp(-6.0, 118.0, humidity_partial); float const compensated_humidity_percentage = humidity_percentage + (20 - temperature_float) * MS8607_H_TEMP_COEFFICIENT; ESP_LOGD(TAG, "Compensated for temperature, humidity=%.2f%%", compensated_humidity_percentage); diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index 1e7306467c..748c8f2237 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -320,6 +320,12 @@ void Application::disable_component_loop_(Component *component) { if (this->in_loop_ && i == this->current_loop_index_) { // Decrement so we'll process the swapped component next this->current_loop_index_--; + // Update the loop start time to current time so the swapped component + // gets correct timing instead of inheriting stale timing. + // This prevents integer underflow in timing calculations by ensuring + // the swapped component starts with a fresh timing reference, avoiding + // errors caused by stale or wrapped timing values. + this->loop_component_start_time_ = millis(); } } return;