UncleRus / esp-idf-lib

Component library for ESP32-xx and ESP8266
https://esp-idf-lib.readthedocs.io/en/latest/
1.42k stars 441 forks source link

mhz19b build error on esp32c6 #577

Closed AxelLin closed 1 year ago

AxelLin commented 1 year ago

The issue

Build on esp-idf-v5.1 branch, with idf.py set-target esp32c6.

Got below build error: esp-idf-lib/components/mhz19b/mhz19b.c: In function 'mhz19b_init': /home/axel/esp/esp-idf-dev/esp-idf-lib/components/mhz19b/mhz19b.c:64:23: error: 'UART_SCLK_APB' undeclared (first use in this function); did you mean 'UART_SCLK_RTC'? 64 | .source_clk = UART_SCLK_APB, | ^~~~~ | UART_SCLK_RTC /home/axel/esp/esp-idf-dev/esp-idf-lib/components/mhz19b/mhz19b.c:64:23: note: each undeclared identifier is reported only once for each function it appears in [1055/1357] Building C object esp-idf/noise/CMakeFiles/__idf_noise.dir/noise.c.objninja: build stopped: subcommand failed.

Which SDK are you using?

esp-idf

Which version of SDK are you using?

v5.1.1-439-gcb174b0fe1

Which build target have you used?

Component causing the issue

mhz19b

Anything in the logs that might be useful for us?

No response

Additional information or context

No response

Confirmation

AxelLin commented 1 year ago

https://github.com/espressif/esp-idf/issues/12314#issuecomment-1736941800 UART_SCLK_APB can be changed to UART_SCLK_DEFAULT.

AxelLin commented 1 year ago

Hi @UncleRus I just notice esp32c6 is not official supported? (Above build target does not include esp32c6) Just wondering if you consider to add esp32c6 support since it is available in esp-idf5.1+.

UncleRus commented 1 year ago

Strange. We already support UART_SCLK_DEFAULT

    ...
    uart_config_t uart_config = {
        .baud_rate = 9600,
        .data_bits = UART_DATA_8_BITS,
        .parity    = UART_PARITY_DISABLE,
        .stop_bits = UART_STOP_BITS_1,
        .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
        .source_clk = UART_SCLK_DEFAULT,
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
        .source_clk = UART_SCLK_APB,
#endif
    };
    ...
AxelLin commented 1 year ago

Hi @UncleRus

oops, I might make you misunderstand ... It works for me, however I notice in https://github.com/UncleRus/esp-idf-lib page The "Supported on" filed for all components does not include support for esp32c6.