mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Merge branch 'reduce_connect_one_loop' into integration
This commit is contained in:
		| @@ -45,8 +45,10 @@ void BLEClientBase::set_state(espbt::ClientState st) { | |||||||
|   ESPBTClient::set_state(st); |   ESPBTClient::set_state(st); | ||||||
|  |  | ||||||
|   if (st == espbt::ClientState::READY_TO_CONNECT) { |   if (st == espbt::ClientState::READY_TO_CONNECT) { | ||||||
|     // Enable loop when we need to connect |     // Enable loop for state processing | ||||||
|     this->enable_loop(); |     this->enable_loop(); | ||||||
|  |     // Connect immediately instead of waiting for next loop | ||||||
|  |     this->connect(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -63,11 +65,6 @@ void BLEClientBase::loop() { | |||||||
|     } |     } | ||||||
|     this->set_state(espbt::ClientState::IDLE); |     this->set_state(espbt::ClientState::IDLE); | ||||||
|   } |   } | ||||||
|   // READY_TO_CONNECT means we have discovered the device |  | ||||||
|   // and the scanner has been stopped by the tracker. |  | ||||||
|   else if (this->state_ == espbt::ClientState::READY_TO_CONNECT) { |  | ||||||
|     this->connect(); |  | ||||||
|   } |  | ||||||
|   // If its idle, we can disable the loop as set_state |   // If its idle, we can disable the loop as set_state | ||||||
|   // will enable it again when we need to connect. |   // will enable it again when we need to connect. | ||||||
|   else if (this->state_ == espbt::ClientState::IDLE) { |   else if (this->state_ == espbt::ClientState::IDLE) { | ||||||
|   | |||||||
| @@ -1,8 +1,13 @@ | |||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #include "defines.h" | ||||||
| #include "component.h" | #include "component.h" | ||||||
| #include "helpers.h" | #include "helpers.h" | ||||||
|  |  | ||||||
|  | #ifdef USE_LVGL | ||||||
|  | #include "esphome/components/lvgl/lvgl_proxy.h" | ||||||
|  | #endif  // USE_LVGL | ||||||
|  |  | ||||||
| namespace esphome { | namespace esphome { | ||||||
|  |  | ||||||
| inline static constexpr uint8_t esp_scale8(uint8_t i, uint8_t scale) { | inline static constexpr uint8_t esp_scale8(uint8_t i, uint8_t scale) { | ||||||
| @@ -33,6 +38,11 @@ struct Color { | |||||||
|     uint32_t raw_32; |     uint32_t raw_32; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | #ifdef USE_LVGL | ||||||
|  |   // convenience function for Color to get a lv_color_t representation | ||||||
|  |   operator lv_color_t() const { return lv_color_make(this->r, this->g, this->b); } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   inline constexpr Color() ESPHOME_ALWAYS_INLINE : raw_32(0) {}  // NOLINT |   inline constexpr Color() ESPHOME_ALWAYS_INLINE : raw_32(0) {}  // NOLINT | ||||||
|   inline constexpr Color(uint8_t red, uint8_t green, uint8_t blue) ESPHOME_ALWAYS_INLINE : r(red), |   inline constexpr Color(uint8_t red, uint8_t green, uint8_t blue) ESPHOME_ALWAYS_INLINE : r(red), | ||||||
|                                                                                            g(green), |                                                                                            g(green), | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ lvgl: | |||||||
|     - id: date_style |     - id: date_style | ||||||
|       text_font: roboto10 |       text_font: roboto10 | ||||||
|       align: center |       align: center | ||||||
|       text_color: color_id2 |       text_color: !lambda return color_id2; | ||||||
|       bg_opa: cover |       bg_opa: cover | ||||||
|       radius: 4 |       radius: 4 | ||||||
|       pad_all: 2 |       pad_all: 2 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user