ソースを参照

Merge branch 'bugfix/remove_esp_adc_wno_flag' into 'master'

esp_adc: remove wno flag

Closes IDF-5765

See merge request espressif/esp-idf!19791
Armando (Dou Yiwen) 3 年 前
コミット
49dc1a32c5

+ 0 - 1
components/esp_adc/CMakeLists.txt

@@ -31,4 +31,3 @@ idf_component_register(SRCS ${srcs}
                        INCLUDE_DIRS ${includes}
                        PRIV_REQUIRES driver efuse
                        LDFRAGMENTS linker.lf)
-target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

+ 2 - 2
components/esp_adc/adc_cali_curve_fitting.c

@@ -174,7 +174,7 @@ static void calc_first_step_coefficients(const adc_calib_info_t *parsed_data, ca
 {
     ctx->chars_first_step.coeff_a = coeff_a_scaling * parsed_data->ref_data.ver1.voltage / parsed_data->ref_data.ver1.digi;
     ctx->chars_first_step.coeff_b = 0;
-    ESP_LOGV(TAG, "Calib V1, Cal Voltage = %d, Digi out = %d, Coef_a = %d\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, ctx->chars_first_step.coeff_a);
+    ESP_LOGV(TAG, "Calib V1, Cal Voltage = %"PRId32", Digi out = %"PRId32", Coef_a = %"PRId32"\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, ctx->chars_first_step.coeff_a);
 }
 
 static void calc_second_step_coefficients(const adc_cali_curve_fitting_config_t *config, cali_chars_curve_fitting_t *ctx)
@@ -224,7 +224,7 @@ static int32_t get_reading_error(uint64_t v_cali_1, const cali_chars_second_step
 
         term[i] = term[i] / (*param->coeff)[atten][i][1];
         error += (int32_t)term[i] * (*param->sign)[atten][i];
-        ESP_LOGV(TAG, "term%d is %llu, error is %d", i, term[i], error);
+        ESP_LOGV(TAG, "term%d is %llu, error is %"PRId32, i, term[i], error);
     }
 
     return error;

+ 3 - 3
components/esp_adc/adc_oneshot.c

@@ -107,7 +107,7 @@ esp_err_t adc_oneshot_new_unit(const adc_oneshot_unit_init_cfg_t *init_config, a
 
     adc_power_acquire();
 
-    ESP_LOGD(TAG, "new adc unit%d is created", unit->unit_id);
+    ESP_LOGD(TAG, "new adc unit%"PRId32" is created", unit->unit_id);
     *ret_unit = unit;
     return ESP_OK;
 
@@ -193,13 +193,13 @@ esp_err_t adc_oneshot_del_unit(adc_oneshot_unit_handle_t handle)
 {
     ESP_RETURN_ON_FALSE(handle, ESP_ERR_INVALID_ARG, TAG, "invalid argument: null pointer");
     bool success_free = s_adc_unit_free(handle->unit_id);
-    ESP_RETURN_ON_FALSE(success_free, ESP_ERR_NOT_FOUND, TAG, "adc%d isn't in use", handle->unit_id + 1);
+    ESP_RETURN_ON_FALSE(success_free, ESP_ERR_NOT_FOUND, TAG, "adc%"PRId32" isn't in use", handle->unit_id + 1);
 
     _lock_acquire(&s_ctx.mutex);
     s_ctx.units[handle->unit_id] = NULL;
     _lock_release(&s_ctx.mutex);
 
-    ESP_LOGD(TAG, "adc unit%d is deleted", handle->unit_id);
+    ESP_LOGD(TAG, "adc unit%"PRId32" is deleted", handle->unit_id);
     free(handle);
 
     adc_power_release();

+ 2 - 2
components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c

@@ -101,7 +101,7 @@ static esp_err_t prepare_calib_data_for(int version_num, adc_unit_t adc_num, adc
  */
 static void calculate_characterization_coefficients(const adc_calib_parsed_info_t *parsed_data, esp_adc_cal_characteristics_t *chars)
 {
-    ESP_LOGD(LOG_TAG, "Calib V1, Cal Voltage = %d, Digi out = %d\n", parsed_data->efuse_data.ver1.voltage, parsed_data->efuse_data.ver1.digi);
+    ESP_LOGD(LOG_TAG, "Calib V1, Cal Voltage = %"PRId32", Digi out = %"PRId32, parsed_data->efuse_data.ver1.voltage, parsed_data->efuse_data.ver1.digi);
 
     chars->coeff_a = coeff_a_scaling * parsed_data->efuse_data.ver1.voltage / parsed_data->efuse_data.ver1.digi;
     chars->coeff_b = 0;
@@ -147,7 +147,7 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
     }
 
     calculate_characterization_coefficients(&efuse_parsed_data, chars);
-    ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%d B:%d\n", adc_num, atten, chars->coeff_a, chars->coeff_b);
+    ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%"PRId32" B:%"PRId32, adc_num, atten, chars->coeff_a, chars->coeff_b);
 
     // Initialize remaining fields
     chars->adc_num = adc_num;

+ 1 - 1
components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c

@@ -178,7 +178,7 @@ esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,
     assert(res);
     res = calculate_characterization_coefficients(&efuse_parsed_data, chars);
     assert(res);
-    ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%d B:%d\n", adc_num, atten, chars->coeff_a, chars->coeff_b);
+    ESP_LOGD(LOG_TAG, "adc%d (atten leven %d) calibration done: A:%"PRId32" B:%"PRId32"\n", adc_num, atten, chars->coeff_a, chars->coeff_b);
 
     // Initialize remaining fields
     chars->adc_num = adc_num;

+ 1 - 1
components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c

@@ -121,7 +121,7 @@ static void calculate_characterization_coefficients(const adc_calib_info_t *pars
 {
     chars->coeff_a = coeff_a_scaling * parsed_data->ref_data.ver1.voltage / parsed_data->ref_data.ver1.digi;
     chars->coeff_b = 0;
-    ESP_LOGV(LOG_TAG, "Calib V1, Cal Voltage = %d, Digi out = %d, Coef_a = %d\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, chars->coeff_a);
+    ESP_LOGV(LOG_TAG, "Calib V1, Cal Voltage = %"PRId32", Digi out = %"PRId32", Coef_a = %"PRId32"\n", parsed_data->ref_data.ver1.voltage, parsed_data->ref_data.ver1.digi, chars->coeff_a);
 }
 
 esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t adc_num,

+ 2 - 1
components/esp_adc/deprecated/esp_adc_cal_common_legacy.c

@@ -6,6 +6,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include "inttypes.h"
 #include "sdkconfig.h"
 
 #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3
@@ -85,7 +86,7 @@ int32_t esp_adc_cal_get_reading_error(const esp_adc_error_calc_param_t *param, u
 
         term[i] = term[i] / (*param->coeff)[atten][i][1];
         error += (int32_t)term[i] * (*param->sign)[atten][i];
-        ESP_LOGV(TAG, "term%d is %llu, error is %d", i, term[i], error);
+        ESP_LOGV(TAG, "term%d is %llu, error is %"PRId32, i, term[i], error);
     }
 
     return error;

+ 1 - 1
components/esp_adc/esp32s2/adc_cali_line_fitting.c

@@ -114,7 +114,7 @@ esp_err_t adc_cali_create_scheme_line_fitting(const adc_cali_line_fitting_config
     assert(success);
     success = calculate_characterization_coefficients(&efuse_parsed_data, chars);
     assert(success);
-    ESP_LOGD(TAG, "adc%d (atten leven %d) calibration done: A:%d B:%d\n", config->unit_id, config->atten, chars->coeff_a, chars->coeff_b);
+    ESP_LOGD(TAG, "adc%d (atten leven %d) calibration done: A:%"PRId32" B:%"PRId32"\n", config->unit_id, config->atten, chars->coeff_a, chars->coeff_b);
     chars->unit_id = config->unit_id;
     chars->atten = config->atten;
 

+ 0 - 1
components/esp_adc/test_apps/adc/main/CMakeLists.txt

@@ -10,4 +10,3 @@ set(srcs "test_app_main.c"
 # the component can be registered as WHOLE_ARCHIVE
 idf_component_register(SRCS ${srcs}
                        WHOLE_ARCHIVE)
-target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

+ 2 - 2
components/esp_adc/test_apps/adc/main/test_adc.c

@@ -216,11 +216,11 @@ static void s_adc_oneshot_with_sleep(adc_unit_t unit_id, adc_channel_t channel)
 
         //Compare
         int32_t raw_diff = raw_expected - raw_after_sleep;
-        ESP_LOGI(TAG, "ADC%d Chan%d: raw difference: %d", unit_id + 1, channel, raw_diff);
+        ESP_LOGI(TAG, "ADC%d Chan%d: raw difference: %"PRId32, unit_id + 1, channel, raw_diff);
 
         if (do_calibration) {
                 int32_t cali_diff = cali_expected - cali_after_sleep;
-                ESP_LOGI(TAG, "ADC%d Chan%d: cali difference: %d", unit_id + 1, channel, cali_diff);
+                ESP_LOGI(TAG, "ADC%d Chan%d: cali difference: %"PRId32, unit_id + 1, channel, cali_diff);
         }
 
         //Test Calibration registers

+ 1 - 1
components/esp_adc/test_apps/adc/main/test_adc_driver_iram.c

@@ -222,7 +222,7 @@ TEST_CASE("ADC continuous work with ISR and Flash", "[adc_oneshot]")
     uint32_t overhead_us = 50;
 #endif
     uint32_t wait_time_us = (1000 * 1000 / ADC_TEST_FREQ_HZ * ADC_TEST_PKG_SIZE / SOC_ADC_DIGI_RESULT_BYTES) + overhead_us;
-    printf("period is %d us\n", wait_time_us);
+    printf("period is %"PRId32" us\n", wait_time_us);
 
     //ADC IO tile low
     test_adc_set_io_level(ADC_UNIT_1, ADC1_TEST_CHAN0, 0);