Examples: Demonstrate the usage of esp_err_to_name

This commit is contained in:
Roland Dobai
2018-02-22 14:48:53 +01:00
parent f891eac827
commit 27a63c492f
31 changed files with 156 additions and 145 deletions

View File

@@ -116,33 +116,33 @@ void app_main()
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
if (esp_bt_controller_init(&bt_cfg) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s initialize controller failed\n", __func__);
if ((ret = esp_bt_controller_init(&bt_cfg)) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s initialize controller failed: %s\n", __func__, esp_err_to_name(ret));
return;
}
if (esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s enable controller failed\n", __func__);
if ((ret = esp_bt_controller_enable(ESP_BT_MODE_CLASSIC_BT)) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s enable controller failed: %s\n", __func__, esp_err_to_name(ret));
return;
}
if (esp_bluedroid_init() != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s initialize bluedroid failed\n", __func__);
if ((ret = esp_bluedroid_init()) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s initialize bluedroid failed: %s\n", __func__, esp_err_to_name(ret));
return;
}
if (esp_bluedroid_enable() != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s enable bluedroid failed\n", __func__);
if ((ret = esp_bluedroid_enable()) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s enable bluedroid failed: %s\n", __func__, esp_err_to_name(ret));
return;
}
if (esp_spp_register_callback(esp_spp_cb) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s spp register failed\n", __func__);
if ((ret = esp_spp_register_callback(esp_spp_cb)) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s spp register failed: %s\n", __func__, esp_err_to_name(ret));
return;
}
if (esp_spp_init(esp_spp_mode) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s spp init failed\n", __func__);
if ((ret = esp_spp_init(esp_spp_mode)) != ESP_OK) {
ESP_LOGE(SPP_TAG, "%s spp init failed: %s\n", __func__, esp_err_to_name(ret));
return;
}
}