mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	[esp32_ble_client] Connect immediately on READY_TO_CONNECT to reduce latency
This commit is contained in:
		| @@ -45,8 +45,10 @@ void BLEClientBase::set_state(espbt::ClientState st) { | ||||
|   ESPBTClient::set_state(st); | ||||
|  | ||||
|   if (st == espbt::ClientState::READY_TO_CONNECT) { | ||||
|     // Enable loop when we need to connect | ||||
|     // Enable loop for state processing | ||||
|     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); | ||||
|   } | ||||
|   // 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 | ||||
|   // will enable it again when we need to connect. | ||||
|   else if (this->state_ == espbt::ClientState::IDLE) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user