mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
Merge branch 'bugfix/abs_arguments' into 'master'
fix warnings: abs() use again Closes GCC-240 See merge request espressif/esp-idf!17846
This commit is contained in:
commit
f4c190cadd
@ -315,8 +315,8 @@ TEST_CASE("LEDC fast switching duty with fade_wait_done", "[ledc]")
|
||||
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_WAIT_DONE));
|
||||
TEST_ASSERT_EQUAL_INT32(1000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
|
||||
fade_stop = esp_timer_get_time();
|
||||
int time_ms = (fade_stop - fade_start) / 1000;
|
||||
TEST_ASSERT_TRUE(fabs(time_ms - 350) < 20);
|
||||
int64_t time_ms = (fade_stop - fade_start) / 1000;
|
||||
TEST_ASSERT_TRUE(llabs(time_ms - 350) < 20);
|
||||
|
||||
// next duty update will not take place until last fade reaches its target duty
|
||||
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 200));
|
||||
@ -347,8 +347,8 @@ TEST_CASE("LEDC fast switching duty with fade_no_wait", "[ledc]")
|
||||
first_fade_complete = esp_timer_get_time();
|
||||
// duty should not be too far from first fade target duty
|
||||
TEST_ASSERT_INT32_WITHIN(20, 4000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
|
||||
int time_ms = (first_fade_complete - fade_start) / 1000;
|
||||
TEST_ASSERT_TRUE(fabs(time_ms - 200) < 20);
|
||||
int64_t time_ms = (first_fade_complete - fade_start) / 1000;
|
||||
TEST_ASSERT_TRUE(llabs(time_ms - 200) < 20);
|
||||
vTaskDelay(158 / portTICK_PERIOD_MS);
|
||||
TEST_ASSERT_EQUAL_INT32(1000, ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0));
|
||||
|
||||
@ -372,7 +372,7 @@ TEST_CASE("LEDC fade stop test", "[ledc]")
|
||||
fade_setup();
|
||||
|
||||
int64_t fade_start, fade_stop;
|
||||
int time_ms = 0;
|
||||
int64_t time_ms = 0;
|
||||
fade_start = esp_timer_get_time();
|
||||
TEST_ESP_OK(ledc_set_fade_with_time(test_speed_mode, LEDC_CHANNEL_0, 4000, 500));
|
||||
TEST_ESP_OK(ledc_fade_start(test_speed_mode, LEDC_CHANNEL_0, LEDC_FADE_NO_WAIT));
|
||||
@ -383,7 +383,7 @@ TEST_CASE("LEDC fade stop test", "[ledc]")
|
||||
TEST_ESP_OK(ledc_fade_stop(test_speed_mode, LEDC_CHANNEL_0));
|
||||
fade_stop = esp_timer_get_time();
|
||||
time_ms = (fade_stop - fade_start) / 1000;
|
||||
TEST_ASSERT_TRUE(fabs(time_ms - 127) < 20);
|
||||
TEST_ASSERT_TRUE(llabs(time_ms - 127) < 20);
|
||||
// Get duty value after fade_stop returns (give at least one cycle for the duty set in fade_stop to take effective)
|
||||
uint32_t duty_after_stop = ledc_get_duty(test_speed_mode, LEDC_CHANNEL_0);
|
||||
TEST_ASSERT_INT32_WITHIN(4, duty_before_stop, duty_after_stop); // 4 is the scale for one step in the last fade
|
||||
|
@ -433,7 +433,7 @@ static void timer_test_monotonic_values_task(void* arg) {
|
||||
/* Allow some difference due to rtos tick interrupting task between
|
||||
* getting 'hs_now' and 'now'.
|
||||
*/
|
||||
if (abs(diff) > 100) {
|
||||
if (llabs(diff) > 100) {
|
||||
error_repeat_cnt++;
|
||||
state->error_cnt++;
|
||||
} else {
|
||||
@ -444,7 +444,7 @@ static void timer_test_monotonic_values_task(void* arg) {
|
||||
state->pass = false;
|
||||
}
|
||||
state->avg_diff += diff;
|
||||
state->max_error = MAX(state->max_error, abs(diff));
|
||||
state->max_error = MAX(state->max_error, llabs(diff));
|
||||
state->test_cnt++;
|
||||
}
|
||||
state->avg_diff /= state->test_cnt;
|
||||
|
@ -402,7 +402,7 @@ void test_fatfs_stat(const char* filename, const char* root_dir)
|
||||
struct tm mtm;
|
||||
localtime_r(&mtime, &mtm);
|
||||
printf("File time: %s", asctime(&mtm));
|
||||
TEST_ASSERT(abs(mtime - t) < 2); // fatfs library stores time with 2 second precision
|
||||
TEST_ASSERT(llabs(mtime - t) < 2); // fatfs library stores time with 2 second precision
|
||||
|
||||
TEST_ASSERT(st.st_mode & S_IFREG);
|
||||
TEST_ASSERT_FALSE(st.st_mode & S_IFDIR);
|
||||
|
@ -292,7 +292,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
@ -306,7 +306,7 @@ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
@ -307,7 +307,7 @@ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
@ -309,7 +309,7 @@ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, uint32_t sclk, uint32_t mcl
|
||||
int denominator = 1;
|
||||
int numerator = 0;
|
||||
|
||||
uint32_t freq_diff = abs(sclk - mclk * mclk_div);
|
||||
uint32_t freq_diff = abs((int)sclk - (int)(mclk * mclk_div));
|
||||
if (!freq_diff) {
|
||||
goto finish;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user