Skip to content

Commit

Permalink
Merge branch 'bugfix/remove_esp_adc_wno_flag_v5.0' into 'release/v5.0'
Browse files Browse the repository at this point in the history
esp_adc: remove wno flag (v5.0)

See merge request espressif/esp-idf!19957
  • Loading branch information
jack0c committed Sep 14, 2022
2 parents f8f3eb2 + 78a38c8 commit 140b7d7
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion components/esp_adc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions components/esp_adc/adc_cali_curve_fitting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions components/esp_adc/adc_oneshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions components/esp_adc/deprecated/esp32c3/esp_adc_cal_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_adc/deprecated/esp32s2/esp_adc_cal_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_adc/deprecated/esp32s3/esp_adc_cal_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion components/esp_adc/deprecated/esp_adc_cal_common_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_adc/esp32s2/adc_cali_line_fitting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion components/esp_adc/test_apps/adc/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
4 changes: 2 additions & 2 deletions components/esp_adc/test_apps/adc/main/test_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 140b7d7

Please sign in to comment.