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

@@ -49,11 +49,14 @@ void app_main(void)
if ( r == ESP_OK ) {
printf("%d: %d\n", output_data, read_raw );
} else if ( r == ESP_ERR_INVALID_STATE ) {
printf("ADC2 not initialized yet.\n");
printf("%s: ADC2 not initialized yet.\n", esp_err_to_name(r));
} else if ( r == ESP_ERR_TIMEOUT ) {
//This can not happen in this example. But if WiFi is in use, such error code could be returned.
printf("ADC2 is in use by Wi-Fi.\n");
printf("%s: ADC2 is in use by Wi-Fi.\n", esp_err_to_name(r));
} else {
printf("%s\n", esp_err_to_name(r));
}
vTaskDelay( 2 * portTICK_PERIOD_MS );
}
}

View File

@@ -238,7 +238,7 @@ static void i2c_test_task(void* arg)
printf("data_l: %02x\n", sensor_data_l);
printf("sensor val: %f\n", (sensor_data_h << 8 | sensor_data_l) / 1.2);
} else {
printf("No ack, sensor not connected...skip...\n");
printf("%s: No ack, sensor not connected...skip...\n", esp_err_to_name(ret));
}
xSemaphoreGive(print_mux);
vTaskDelay(( DELAY_TIME_BETWEEN_ITEMS_MS * ( task_idx + 1 ) ) / portTICK_RATE_MS);
@@ -267,7 +267,7 @@ static void i2c_test_task(void* arg)
printf("====TASK[%d] Master read ====\n", task_idx);
disp_buf(data_rd, d_size);
} else {
printf("Master read slave error, IO not connected...\n");
printf("%s: Master read slave error, IO not connected...\n", esp_err_to_name(ret));
}
xSemaphoreGive(print_mux);
vTaskDelay(( DELAY_TIME_BETWEEN_ITEMS_MS * ( task_idx + 1 ) ) / portTICK_RATE_MS);
@@ -293,7 +293,7 @@ static void i2c_test_task(void* arg)
printf("----TASK[%d] Slave read: [%d] bytes ----\n", task_idx, size);
disp_buf(data, size);
} else {
printf("TASK[%d] Master write slave error, IO not connected....\n", task_idx);
printf("TASK[%d] %s: Master write slave error, IO not connected....\n", task_idx, esp_err_to_name(ret));
}
xSemaphoreGive(print_mux);
vTaskDelay(( DELAY_TIME_BETWEEN_ITEMS_MS * ( task_idx + 1 ) ) / portTICK_RATE_MS);