Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on ESP-IDF 5.4, drop 4.x support #401

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
format-check:
runs-on: ubuntu-latest
container:
image: "espressif/idf:release-v5.3"
image: "espressif/idf:release-v5.4"
steps:
- uses: actions/checkout@v4
- run: |
Expand All @@ -22,19 +22,25 @@ jobs:
fail-fast: false
matrix:
version:
- release-v4.4
- release-v5.1
- release-v5.2
- release-v5.3
- release-v5.4
target:
- esp32
- esp32s3
example:
- calibration_helper
- demo
- dragon
- grayscale_test
- www-image
include:
- version: release-v5.1
- version: release-v5.4
example: screen_diag
- version: release-v5.4
example: dragon
- version: release-v5.4
example: grayscale_test
- version: release-v5.4
example: www-image
- version: release-v5.4
example: calibration_helper

continue-on-error: ${{ matrix.version == 'latest' }}

Expand All @@ -45,6 +51,7 @@ jobs:
- uses: 'espressif/esp-idf-ci-action@main'
with:
esp_idf_version: ${{ matrix.version }}
target: ${{ matrix.target }}
path: 'examples/${{ matrix.example }}'

build-arduino:
Expand All @@ -55,12 +62,11 @@ jobs:
fail-fast: false
matrix:
version:
- release-v4.4
- release-v5.3.2
example:
- weather
include:
- version: release-v4.4
arduino-esp32: 2.0.11
arduino-esp32:
- 3.1.3

steps:
- name: Install latest git
Expand Down
4 changes: 2 additions & 2 deletions examples/weather/main/ArduinoJson.h
Original file line number Diff line number Diff line change
Expand Up @@ -4546,8 +4546,8 @@ struct BoundedReader<TSource*, typename enable_if<IsCharOrVoid<TSource>::value>:
public:
explicit BoundedReader(const void* ptr, size_t len)
: IteratorReader<const char*>(
reinterpret_cast<const char*>(ptr), reinterpret_cast<const char*>(ptr) + len
) {}
reinterpret_cast<const char*>(ptr), reinterpret_cast<const char*>(ptr) + len
) {}
};
template <typename TArray>
struct Reader<ElementProxy<TArray>, void> : Reader<char*, void> {
Expand Down
13 changes: 6 additions & 7 deletions examples/www-image/main/jpg-render.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,14 @@ static void http_post(void) {
* either in URL or as host and path parameters.
* FIX: Uncommenting cert_pem restarts even if providing the right certificate
*/
esp_http_client_config_t config
= {.url = IMG_URL,
.event_handler = _http_event_handler,
.buffer_size = HTTP_RECEIVE_BUFFER_SIZE,
.disable_auto_redirect = false,
esp_http_client_config_t config = { .url = IMG_URL,
.event_handler = _http_event_handler,
.buffer_size = HTTP_RECEIVE_BUFFER_SIZE,
.disable_auto_redirect = false,
#if VALIDATE_SSL_CERTIFICATE == true
.cert_pem = (char*)server_cert_pem_start
.cert_pem = (char*)server_cert_pem_start
#endif
};
};
esp_http_client_handle_t client = esp_http_client_init(&config);

#if DEBUG_VERBOSE
Expand Down
11 changes: 5 additions & 6 deletions examples/www-image/main/jpgdec-render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,13 @@ static void http_post(void) {
* NOTE: All the configuration parameters for http_client must be specified
* either in URL or as host and path parameters.
*/
esp_http_client_config_t config
= {.url = IMG_URL,
esp_http_client_config_t config = { .url = IMG_URL,
#if VALIDATE_SSL_CERTIFICATE == true
.cert_pem = (char*)server_cert_pem_start,
.cert_pem = (char*)server_cert_pem_start,
#endif
.disable_auto_redirect = false,
.event_handler = _http_event_handler,
.buffer_size = HTTP_RECEIVE_BUFFER_SIZE };
.disable_auto_redirect = false,
.event_handler = _http_event_handler,
.buffer_size = HTTP_RECEIVE_BUFFER_SIZE };

esp_http_client_handle_t client = esp_http_client_init(&config);

Expand Down
4 changes: 0 additions & 4 deletions src/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

#include "epdiy.h"

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
#include "rom/miniz.h"
#else
#include <miniz.h>
#endif
#include <math.h>
#include <stdio.h>
#include <string.h>
Expand Down
3 changes: 0 additions & 3 deletions src/output_common/lut.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
#include <stdlib.h>
#include <string.h>

#include "esp_system.h" // for ESP_IDF_VERSION_VAL
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "esp_timer.h"
#endif

/*
* Build Lookup tables and translate via LUTs.
Expand Down
5 changes: 3 additions & 2 deletions src/output_common/render_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,6 @@ void prepare_context_for_next_frame(RenderContext_t* ctx);
*
* don't inline for to ensure availability in tests.
*/
void __attribute__((noinline))
epd_populate_line_mask(uint8_t* line_mask, const uint8_t* dirty_columns, int mask_len);
void __attribute__((noinline)) epd_populate_line_mask(
uint8_t* line_mask, const uint8_t* dirty_columns, int mask_len
);
12 changes: 0 additions & 12 deletions src/output_i2s/i2s_data_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
#include "soc/rtc.h"

#include "esp_system.h" // for ESP_IDF_VERSION_VAL
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "esp_private/periph_ctrl.h"
#else
#include "driver/periph_ctrl.h"
#endif

/// DMA descriptors for front and back line buffer.
/// We use two buffers, so one can be filled while the other
Expand Down Expand Up @@ -214,12 +210,8 @@ void i2s_bus_init(i2s_bus_config* cfg, uint32_t epd_row_width) {
dev->sample_rate_conf.tx_bck_div_num = 2;

// Initialize Audio Clock (APLL)
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
rtc_clk_apll_enable(true);
rtc_clk_apll_coeff_set(0, 0, 0, 8);
#else
rtc_clk_apll_enable(1, 0, 0, 8, 0);
#endif

// Set Audio Clock Dividers
dev->clkm_conf.val = 0;
Expand Down Expand Up @@ -302,12 +294,8 @@ void i2s_bus_deinit() {
free((void*)i2s_state.dma_desc_a);
free((void*)i2s_state.dma_desc_b);

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
rtc_clk_apll_coeff_set(0, 0, 0, 8);
rtc_clk_apll_enable(true);
#else
rtc_clk_apll_enable(0, 0, 0, 8, 0);
#endif

periph_module_disable(PERIPH_I2S1_MODULE);
}
Expand Down
10 changes: 0 additions & 10 deletions src/output_i2s/render_i2s.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
#include <driver/gpio.h>
#include <esp_assert.h>
#include <esp_system.h>
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include <hal/gpio_ll.h>
#include <soc/gpio_struct.h>
#endif

#include "../output_common/render_context.h"
#include "sdkconfig.h"
Expand Down Expand Up @@ -42,12 +40,8 @@ void i2s_deinit();
*/
inline void fast_gpio_set_hi(gpio_num_t gpio_num) {
#ifdef CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
gpio_dev_t* device = GPIO_LL_GET_HW(GPIO_PORT_0);
device->out_w1ts = (1 << gpio_num);
#else
GPIO.out_w1ts = (1 << gpio_num);
#endif
#else
// not supportd on non ESP32 chips
assert(false);
Expand All @@ -56,12 +50,8 @@ inline void fast_gpio_set_hi(gpio_num_t gpio_num) {

inline void fast_gpio_set_lo(gpio_num_t gpio_num) {
#ifdef CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
gpio_dev_t* device = GPIO_LL_GET_HW(GPIO_PORT_0);
device->out_w1tc = (1 << gpio_num);
#else
GPIO.out_w1tc = (1 << gpio_num);
#endif
#else
// not supportd on non ESP32 chips
assert(false);
Expand Down
6 changes: 0 additions & 6 deletions src/output_i2s/rmt_pulse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#ifdef RENDER_METHOD_I2S

#include "driver/rmt.h"
#include "esp_system.h"
#include "rmt_pulse.h"

#include "soc/rmt_struct.h"
Expand All @@ -25,15 +24,13 @@ static void IRAM_ATTR rmt_interrupt_handler(void* arg) {
RMT.int_clr.val = RMT.int_st.val;
}

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
// The extern line is declared in esp-idf/components/driver/deprecated/rmt_legacy.c. It has access
// to RMTMEM through the rmt_private.h header which we can't access outside the sdk. Declare our own
// extern here to properly use the RMTMEM smybol defined in
// components/soc/[target]/ld/[target].peripherals.ld Also typedef the new rmt_mem_t struct to the
// old rmt_block_mem_t struct. Same data fields, different names
typedef rmt_mem_t rmt_block_mem_t;
extern rmt_block_mem_t RMTMEM;
#endif

void rmt_pulse_init(gpio_num_t pin) {
row_rmt_config.rmt_mode = RMT_MODE_TX;
Expand All @@ -52,9 +49,6 @@ void rmt_pulse_init(gpio_num_t pin) {
row_rmt_config.tx_config.idle_level = RMT_IDLE_LEVEL_LOW;
row_rmt_config.tx_config.idle_output_en = true;

#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 2, 0) && ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(4, 0, 2)
#error "This driver is not compatible with IDF version 4.1.\nPlease use 4.0 or >= 4.2!"
#endif
esp_intr_alloc(
ETS_RMT_INTR_SOURCE, ESP_INTR_FLAG_LEVEL3, rmt_interrupt_handler, 0, &gRMT_intr_handle
);
Expand Down
Loading
Loading