mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Merge remote-tracking branch 'upstream/dev' into memory_api
This commit is contained in:
		| @@ -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 { | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user