Postby rboeije » Mon Jul 17, 2023 3:02 pm
While it looks like an old post, there is no solution listed. That is, the proposed solution is the source of the problem.
I got the error after the Arduino 2.2.2 updated the libraries to 2.0.10. Maybe it was resolved in the old version, but that is deleted as part of the upgrade.
As the original poster states, in adc.h (C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.10\tools\sdk\esp32\include\driver\include\driver)
line 98, the line
#define ADC_WIDTH_BIT_DEFAULT (ADC_WIDTH_MAX -1)
causes a compiler error fpermissive on subtracting 1 from a enum type:
C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.10/tools/sdk/esp32/include/driver/include/driver/adc.h:98:47: error: invalid conversion from 'int' to 'adc_bits_width_t' [-fpermissive]
#define ADC_WIDTH_BIT_DEFAULT (ADC_WIDTH_MAX -1)
~~~~~~~~~~~~~~~^~~
C:\Users\XXX\OneDrive\Documenten\Arduino\YYYYY_ESP32\YYYYY_ESP32.ino:1204:55: note: in expansion of macro 'ADC_WIDTH_BIT_DEFAULT'
esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_DEFAULT, 0, &adc1_chars);
^~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\XXX\OneDrive\Documenten\Arduino\YYYYY_ESP32\YYYYY_ESP32.ino:62:
C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.10/tools/sdk/esp32/include/esp_adc_cal/include/esp_adc_cal.h:90:63: note: initializing argument 3 of 'esp_adc_cal_value_t esp_adc_cal_characterize(adc_unit_t, adc_atten_t, adc_bits_width_t, uint32_t, esp_adc_cal_characteristics_t*)'
adc_bits_width_t bit_width,
~~~~~~~~~~~~~~~~~^~~~~~~~~