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

get ready for ESP-IDF v5 #180

Merged
merged 28 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f1e266c
160 remove board defines (#168)
mickeprag May 30, 2022
715dd9e
enable CI runs on latest ESP-IDF version
jdoubleu May 10, 2022
82c20ad
replace deprecated portTICK_RATE_MS macro
jdoubleu May 8, 2022
e8c850c
add missing headers
jdoubleu May 8, 2022
2e37f07
update clock usage
second-string Jun 9, 2022
bf44ee5
Merge branch 'master' into esp-idf-latest
jdoubleu Jul 6, 2022
1f9ae21
update GPIO usage
second-string Jul 6, 2022
854688b
add missing libsodium component as dependency
jdoubleu Jul 6, 2022
a6853b2
fix minor errors in examples
jdoubleu Jul 6, 2022
976b220
migrate TCP/IP adapter API in mpd_status
jdoubleu Jul 7, 2022
4653f2c
update component registration in weather example
jdoubleu Jul 7, 2022
4205e99
disable CI job to build arduino-esp32 with ESP-IDF v5
jdoubleu Jul 7, 2022
6e9d620
Use gpio port correctly instead of pin when getting LL device
second-string Jul 12, 2022
251a58e
Fix log print format specifer in www-image example
second-string Jul 12, 2022
0770e4a
Add 'rules' to idf_component yaml file in mpd_status example to corre…
second-string Jul 12, 2022
e18272b
Fix pointer arg to error handling function
second-string Jul 12, 2022
d347a99
Switch between format specifiers based on esp-idf version in www-imag…
second-string Jul 12, 2022
bc7c11d
remove IRAM_ATTR macros from header declarations
jdoubleu Jul 19, 2022
1317f78
fix warnings about type incompatibilities
jdoubleu Jul 19, 2022
f924efd
replace deprecated header
jdoubleu Jul 19, 2022
8db81c9
Empty commit to kick CI to see if new esp-idf releave_v4.3 container …
second-string Jul 25, 2022
c85bf5e
Update cmakelists to support v5.0-beta1 driver and adc component chan…
second-string Aug 24, 2022
8df2dd6
Fix CMakeLists to support correct component lists for both idf 4.X an…
second-string Aug 25, 2022
fe1e6e8
Switch 'latest' esp-idf container tag to 'v5.0-beta1'
second-string Aug 25, 2022
e6853ee
Explicitly add missing components to mpd_status and www-image example…
second-string Aug 25, 2022
c8f2853
Bump to newly release esp-idf 5.0 docker container for CI
second-string Oct 26, 2022
18f6e01
Merge remote-tracking branch 'fork_parent/master' into HEAD
second-string Dec 21, 2022
3184a73
fix log statements after uint32_t alias changed
jdoubleu Dec 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
version:
- release-v4.3
- release-v4.4
- release-v5.0
example:
- calibration_helper
- demo
Expand All @@ -23,7 +24,7 @@ jobs:
- mpd_status
- terminal
- www-image

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

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ fp-info-cache
__pycache__
examples/weather/components
sdkconfig
managed_components/
3 changes: 2 additions & 1 deletion examples/demo/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "sdkconfig.h"
#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "epd_driver.h"
#include "epd_highlevel.h"
Expand Down Expand Up @@ -105,7 +106,7 @@ void idf_loop() {
err = epd_hl_update_screen(&hl, MODE_GL16, temperature);
t2 = millis();
epd_poweroff();
printf("EPD update %dms. err: %d\n", t2 - t1, err);
printf("EPD update %"PRIu32"ms. err: %u\n", t2 - t1, err);

for (int i=0; i < 6; i++) {
epd_poweron();
Expand Down
1 change: 1 addition & 0 deletions examples/mpd_status/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.16.0)
set(EXTRA_COMPONENT_DIRS "../../src/")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

project(mpd_status)
3 changes: 2 additions & 1 deletion examples/mpd_status/components/libmpdclient/src/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>

static int
handle_error(struct mpd_connection *c)
Expand Down Expand Up @@ -169,7 +170,7 @@ int main(int argc, char ** argv) {

audio_format = mpd_status_get_audio_format(status);
if (audio_format != NULL) {
printf("sampleRate: %i\n", audio_format->sample_rate);
printf("sampleRate: %"PRIu32"\n", audio_format->sample_rate);
printf("bits: %i\n", audio_format->bits);
printf("channels: %i\n", audio_format->channels);
}
Expand Down
15 changes: 15 additions & 0 deletions examples/mpd_status/dependencies.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies:
espressif/libsodium:
component_hash: 36e9832f40c909c0a9135a3e775fcbdd7a2a13d47a1c052ee5b21499eb3eddb5
source:
service_url: https://api.components.espressif.com/
type: service
version: 1.0.20
idf:
component_hash: null
source:
type: idf
version: 5.0.0
manifest_hash: 9d4dcd3c8f27cde5e52f2fba13d202ee2deaa3855572295835aeeb508b8b2c24
target: esp32
version: 1.0.0
2 changes: 1 addition & 1 deletion examples/mpd_status/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set(app_sources "main.c" "mpd_image.c" "mpd_info.c")

idf_component_register(SRCS ${app_sources} REQUIRES epd_driver libmpdclient nvs_flash libsodium)
idf_component_register(SRCS ${app_sources} REQUIRES epd_driver libmpdclient nvs_flash libsodium esp_event esp_wifi)
22 changes: 22 additions & 0 deletions examples/mpd_status/main/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## IDF Component Manager Manifest File
# This file is only required since ESP-IDF v5.
dependencies:
## Required IDF version
idf:
version: ">=4.1"
# # Put list of dependencies here
# # For components maintained by Espressif:
# component: "~1.0.0"
# # For 3rd party components:
# username/component: ">=1.0.0,<2.0.0"
# username2/component2:
# version: "~1.0.0"
# # For transient dependencies `public` flag can be set.
# # `public` flag doesn't have an effect dependencies of the `main` component.
# # All dependencies of `main` are public by default.
# public: true
espressif/libsodium:
version: "~1.0.20"
rules:
- if: "idf_version >= 5.0.0"

22 changes: 19 additions & 3 deletions examples/mpd_status/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "sdkconfig.h"
#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "epd_driver.h"
#include "epd_highlevel.h"
Expand All @@ -29,6 +30,13 @@
#include "mpd_image.h"
#include "mpd_info.h"

#include "esp_system.h" // for ESP_IDF_VERSION_VAL
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
#include "esp_netif.h"
#else
#include "tcpip_adapter.h"
#endif

const int queue_x_start = 900;
const int album_cover_x = 100;
const int album_cover_y = 100;
Expand Down Expand Up @@ -106,8 +114,16 @@ void epd_task() {
}

ESP_ERROR_CHECK(ret);
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
esp_netif_init();
#else
tcpip_adapter_init();
#endif

ESP_ERROR_CHECK(esp_event_loop_create_default());
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
esp_netif_create_default_wifi_sta();
#endif

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
Expand Down Expand Up @@ -188,7 +204,7 @@ void epd_task() {
free_playback_info(playback_info);

playback_info = new_info;
ESP_LOGW("info", "info is null? %X", (uint32_t)new_info);
ESP_LOGW("info", "info is null? %"PRIX32"", (uint32_t)new_info);
ESP_LOGW("info", "do update? %d", do_update);

// no song playing
Expand Down Expand Up @@ -301,7 +317,7 @@ void epd_task() {
.x = album_cover_x,
.y = album_cover_y,
};
printf("album cover dimensions: %dx%d\n", album_cover->width,
printf("album cover dimensions: %"PRIu32"x%"PRIu32"\n", album_cover->width,
album_cover->height);
album_height = album_cover->height;
epd_copy_to_framebuffer(area, album_cover->data, img_buf);
Expand All @@ -312,7 +328,7 @@ void epd_task() {
.x = album_cover_x,
.y = album_cover_y,
};
printf("album cover dimensions: %dx%d\n", DefaultAlbum_width, DefaultAlbum_height);
printf("album cover dimensions: %"PRIu32"x%"PRIu32"\n", DefaultAlbum_width, DefaultAlbum_height);
album_height = DefaultAlbum_height;
epd_copy_to_framebuffer(area, (uint8_t*)DefaultAlbum_data, img_buf);
}
Expand Down
19 changes: 10 additions & 9 deletions examples/mpd_status/main/mpd_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "mpd_image.h"

Expand Down Expand Up @@ -41,7 +42,7 @@ feed_jpg_chunk(JDEC *jd, /* Decompressor object */
image_fetch_context_t *context = jd->device;
if (context->chunk_data == NULL) {
char offset_s[32];
snprintf(offset_s, sizeof(offset_s), "%u", context->cover_offset);
snprintf(offset_s, sizeof(offset_s), "%"PRIu32"", context->cover_offset);

printf("use albumart: %d\n", context->use_albumart);
struct mpd_connection *c = context->conn;
Expand Down Expand Up @@ -69,7 +70,7 @@ feed_jpg_chunk(JDEC *jd, /* Decompressor object */
context->use_albumart = true;
ESP_LOGI("mpd_image", "no image with readpicture, trying albumart...\n");
if (!mpd_response_finish(c)) {
handle_error(c);
handle_error(&c);
return -1;
}
int returned = feed_jpg_chunk(jd, buff, nd);
Expand All @@ -78,7 +79,7 @@ feed_jpg_chunk(JDEC *jd, /* Decompressor object */
}

if (!mpd_response_finish(c)) {
handle_error(c);
handle_error(&c);
return -1;
}
fprintf(stderr, "No 'size'\n");
Expand All @@ -91,36 +92,36 @@ feed_jpg_chunk(JDEC *jd, /* Decompressor object */
pair = mpd_recv_pair_named(c, "binary");
if (pair == NULL) {
if (mpd_connection_get_error(c) != MPD_ERROR_SUCCESS) {
handle_error(c);
handle_error(&c);
return -1;
}
fprintf(stderr, "No 'binary'\n");
return -1;
}

uint32_t chunk_size = strtoull(pair->value, NULL, 10);
printf("chunk size: %d\n", chunk_size);
printf("chunk size: %"PRIu32"\n", chunk_size);
mpd_return_pair(c, pair);

if (chunk_size == 0) {
if (!mpd_response_finish(c)) {
handle_error(c);
handle_error(&c);
return -1;
}
return 0;
}

context->chunk_data = malloc(chunk_size);
if (!mpd_recv_binary(c, context->chunk_data, chunk_size)) {
handle_error(c);
handle_error(&c);
return -1;
}

context->chunk_data_size = chunk_size;
context->chunk_data_offset = 0;

if (!mpd_response_finish(c)) {
handle_error(c);
handle_error(&c);
return -1;
}
context->cover_offset += chunk_size;
Expand Down Expand Up @@ -236,7 +237,7 @@ album_cover_t *readpicture(struct mpd_connection *c, char *uri,
context.decoded_image = buf;
context.scale = scale;
printf("orig width: %d orig height: %d\n", jd.width, jd.height);
printf("scaled width: %d scaled height: %d\n", width, height);
printf("scaled width: %"PRIu32" scaled height: %"PRIu32"\n", width, height);

/* Start to decompress the JPEG file */
rc = jd_decomp(&jd, tjd_output, scale);
Expand Down
7 changes: 6 additions & 1 deletion examples/terminal/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* clears execute in 1.075 seconds and images are drawn in 1.531 seconds.
*/

#include "esp_system.h" // for ESP_IDF_VERSION_VAL
#include "driver/uart.h"
#include "esp_heap_caps.h"
#include "driver/gpio.h"
Expand Down Expand Up @@ -77,7 +78,11 @@ void app_main() {
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
.use_ref_tick = true,
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
.source_clk = UART_SCLK_REF_TICK
#else
.use_ref_tick = true
#endif
};
uart_param_config(UART_NUM_1, &uart_config);
// Change here to modify tx/rx pins
Expand Down
5 changes: 3 additions & 2 deletions examples/terminal/main/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "esp_sleep.h"
#include "st.h"
#include "config.h"
#include "esp_timer.h"

//#include "win.h"

Expand Down Expand Up @@ -225,7 +226,7 @@ static char utf8encodebyte(Rune, size_t);
static size_t utf8validate(Rune *, size_t);

static char *base64dec(const char *);
static char base64dec_getc(const char **);
static char base64dec_getc(const signed char **);

//static ssize_t xwrite(int, const char *, size_t);
static const EpdFont* get_font(Glyph g);
Expand Down Expand Up @@ -422,7 +423,7 @@ static const char base64_digits[] = {
};

char
base64dec_getc(const char **src)
base64dec_getc(const signed char **src)
{
while (**src && !isprint(**src))
(*src)++;
Expand Down
6 changes: 3 additions & 3 deletions examples/weather/main/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(COMPONENT_SRCS "weather.cpp" )
set(COMPONENT_ADD_INCLUDEDIRS "")
set(app_sources "weather.cpp")

register_component()
idf_component_register(SRCS ${app_sources}
REQUIRES epd_driver arduino)
4 changes: 2 additions & 2 deletions examples/www-image/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ set(
)

idf_component_register(SRCS ${app_sources}
REQUIRES epd_driver
REQUIRES epd_driver esp_wifi
# Add only if you use jpgdec-render.cpp example
jpegdec
nvs_flash esp-tls esp_http_client
# Embed the server root certificate into the final binary
EMBED_TXTFILES ${project_dir}/ssl_cert/server_cert.pem
)
)