@@ -115,6 +115,8 @@ extern int r_ble_log_deinit_async(void);
115115extern void r_ble_log_async_select_dump_buffers (uint8_t buffers );
116116extern void r_ble_log_async_output_dump_all (bool output );
117117extern void esp_panic_handler_reconfigure_wdts (uint32_t timeout_ms );
118+ extern int r_ble_log_ctrl_level_and_mod (uint8_t log_level , uint32_t mod_switch );
119+ extern int r_ble_ctrl_mod_type (uint16_t mod , uint32_t mod_type_switch );
118120#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
119121extern int r_ble_controller_deinit (void );
120122extern int r_ble_controller_enable (uint8_t mode );
@@ -267,6 +269,11 @@ esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
267269 }
268270
269271 ret = r_ble_log_init_async (bt_controller_log_interface , task_create , buffers , (uint32_t * )log_bufs_size );
272+ if (ret != ESP_OK ) {
273+ return ret ;
274+ }
275+
276+ ret = r_ble_log_ctrl_level_and_mod (CONFIG_BT_LE_CONTROLLER_LOG_OUTPUT_LEVEL , CONFIG_BT_LE_CONTROLLER_LOG_MOD_OUTPUT_SWITCH );
270277 if (ret == ESP_OK ) {
271278 log_is_inited = true;
272279 }
@@ -403,6 +410,22 @@ void esp_bt_read_ctrl_log_from_flash(bool output)
403410 assert (err == ESP_OK );
404411}
405412#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
413+
414+ #if CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
415+ void esp_task_wdt_isr_user_handler (void )
416+ {
417+ esp_ble_controller_log_dump_all (true);
418+ }
419+ #endif // CONFIG_BT_LE_CONTROLLER_LOG_TASK_WDT_USER_HANDLER_ENABLE
420+
421+ #if CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
422+ void __real_esp_panic_handler (void * info );
423+ void __wrap_esp_panic_handler (void * info )
424+ {
425+ esp_ble_controller_log_dump_all (true);
426+ __real_esp_panic_handler (info );
427+ }
428+ #endif // CONFIG_BT_LE_CONTROLLER_LOG_WRAP_PANIC_HANDLER_ENABLE
406429#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
407430
408431/* This variable tells if BLE is running */
@@ -937,6 +960,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
937960 ESP_LOGW (NIMBLE_PORT_LOG_TAG , "controller_sleep_init failed %d" , ret );
938961 goto free_controller ;
939962 }
963+
940964 ESP_ERROR_CHECK (esp_read_mac ((uint8_t * )mac , ESP_MAC_BT ));
941965 ESP_LOGI (NIMBLE_PORT_LOG_TAG , "Bluetooth MAC: %02x:%02x:%02x:%02x:%02x:%02x" ,
942966 mac [0 ], mac [1 ], mac [2 ], mac [3 ], mac [4 ], mac [5 ]);
@@ -1047,6 +1071,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
10471071#if CONFIG_SW_COEXIST_ENABLE
10481072 coex_enable ();
10491073#endif // CONFIG_SW_COEXIST_ENABLE
1074+
10501075#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
10511076 r_ble_ll_scan_start_time_init_compensation (500 );
10521077 r_priv_sdk_config_insert_proc_time_set (500 );
0 commit comments