mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 23:21:54 +00:00 
			
		
		
		
	Merge branch 'esp32_remove_esp32_ard_apis' into integration
This commit is contained in:
		| @@ -15,6 +15,10 @@ | ||||
| #include <freertos/task.h> | ||||
| #include <nvs_flash.h> | ||||
|  | ||||
| #ifdef USE_ARDUINO | ||||
| #include <esp32-hal-bt.h> | ||||
| #endif | ||||
|  | ||||
| namespace esphome::esp32_ble { | ||||
|  | ||||
| static const char *const TAG = "esp32_ble"; | ||||
| @@ -136,6 +140,12 @@ void ESP32BLE::advertising_init_() { | ||||
|  | ||||
| bool ESP32BLE::ble_setup_() { | ||||
|   esp_err_t err; | ||||
| #ifdef USE_ARDUINO | ||||
|   if (!btStart()) { | ||||
|     ESP_LOGE(TAG, "btStart failed: %d", esp_bt_controller_get_status()); | ||||
|     return false; | ||||
|   } | ||||
| #else | ||||
|   if (esp_bt_controller_get_status() != ESP_BT_CONTROLLER_STATUS_ENABLED) { | ||||
|     // start bt controller | ||||
|     if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) { | ||||
| @@ -160,6 +170,7 @@ bool ESP32BLE::ble_setup_() { | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|   esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT); | ||||
|  | ||||
| @@ -251,6 +262,12 @@ bool ESP32BLE::ble_dismantle_() { | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
| #ifdef USE_ARDUINO | ||||
|   if (!btStop()) { | ||||
|     ESP_LOGE(TAG, "btStop failed: %d", esp_bt_controller_get_status()); | ||||
|     return false; | ||||
|   } | ||||
| #else | ||||
|   if (esp_bt_controller_get_status() != ESP_BT_CONTROLLER_STATUS_IDLE) { | ||||
|     // stop bt controller | ||||
|     if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_ENABLED) { | ||||
| @@ -274,6 +291,7 @@ bool ESP32BLE::ble_dismantle_() { | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
|   return true; | ||||
| } | ||||
|  | ||||
|   | ||||
							
								
								
									
										1
									
								
								tests/components/esp32_ble/test.esp32-ard.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/components/esp32_ble/test.esp32-ard.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <<: !include common.yaml | ||||
							
								
								
									
										1
									
								
								tests/components/esp32_ble/test.esp32-c3-ard.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/components/esp32_ble/test.esp32-c3-ard.yaml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| <<: !include common.yaml | ||||
		Reference in New Issue
	
	Block a user