diff --git a/src/lgfx/v1/platforms/esp32/Panel_CVBS.cpp b/src/lgfx/v1/platforms/esp32/Panel_CVBS.cpp index 5693f0e5..9e1f74ea 100644 --- a/src/lgfx/v1/platforms/esp32/Panel_CVBS.cpp +++ b/src/lgfx/v1/platforms/esp32/Panel_CVBS.cpp @@ -45,19 +45,16 @@ Inspiration Sources: #if __has_include() #include #define LGFX_I2S_STD_ENABLED + #if __has_include () + #include + #include + #include + #endif #else #include -#endif - -#if __has_include () - #include - #include - #include -#else #include #endif - #if __has_include() // ESP-IDF v5 #include @@ -1931,10 +1928,12 @@ namespace lgfx } static dac_channel_t _get_dacchannel(int pin) { -#if defined ( LGFX_I2S_STD_ENABLED ) - return (pin == 25) ? DAC_CHAN_0 : DAC_CHAN_1; -#else +#if !defined (ESP_IDF_VERSION_VAL) + return (pin == 25) ? DAC_CHANNEL_1 : DAC_CHANNEL_2; +#elif ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 1, 0) return (pin == 25) ? DAC_CHANNEL_1 : DAC_CHANNEL_2; +#else + return (pin == 25) ? DAC_CHAN_0 : DAC_CHAN_1; #endif } @@ -1963,7 +1962,7 @@ namespace lgfx I2S0.out_link.start = 0; I2S0.conf.tx_start = 0; -#if __has_include () +#if defined ( LGFX_I2S_STD_ENABLED ) dac_ll_digi_enable_dma(false); auto ch = _get_dacchannel(_config_detail.pin_dac); dac_ll_power_down(ch); @@ -2013,7 +2012,7 @@ namespace lgfx } _started = true; -#if __has_include () +#if defined ( LGFX_I2S_STD_ENABLED ) { static constexpr const gpio_num_t gpio_table[2] = { GPIO_NUM_25, GPIO_NUM_26 }; // for ESP32 (not ESP32S2, s2=gpio17,gpio18) for (int i = 0; i < 2; ++i) {