From 912084b62b091c431f80d136905586a25e6fbbc3 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Tue, 10 Dec 2024 15:13:40 +0100 Subject: [PATCH] Fix and enable CI for arduino/esp32 serial --- .github/workflows/arduino_esp32.yaml | 2 +- src/system/arduino/esp32/network.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/arduino_esp32.yaml b/.github/workflows/arduino_esp32.yaml index a1c386616..41e781d28 100644 --- a/.github/workflows/arduino_esp32.yaml +++ b/.github/workflows/arduino_esp32.yaml @@ -51,7 +51,7 @@ jobs: mkdir -p $ARDUINO_BASE cd $ARDUINO_BASE - platformio init -b esp32thing_plus -O "board_build.cmake_extra_args=-DZ_FEATURE_LINK_BLUETOOTH=1" -O "build_flags=-DZENOH_DEBUG=3 -DZENOH_COMPILER_GCC" -O "lib_ldf_mode=deep+" + platformio init -b esp32thing_plus -O "board_build.cmake_extra_args=-DZ_FEATURE_LINK_BLUETOOTH=1 -DZ_FEATURE_LINK_SERIAL=1" -O "build_flags=-DZENOH_DEBUG=3 -DZENOH_COMPILER_GCC" -O "lib_ldf_mode=deep+" cd $ARDUINO_BASE/lib ln -s $ZENOH_PICO_BASE diff --git a/src/system/arduino/esp32/network.cpp b/src/system/arduino/esp32/network.cpp index 1a37cb51f..7eb2e1f02 100644 --- a/src/system/arduino/esp32/network.cpp +++ b/src/system/arduino/esp32/network.cpp @@ -685,6 +685,9 @@ z_result_t _z_open_serial_from_pins(_z_sys_net_socket_t *sock, uint32_t txpin, u } } + sock->tmp_buf = (uint8_t *)z_malloc(_Z_SERIAL_MFS_SIZE); + sock->raw_buf = (uint8_t *)z_malloc(_Z_SERIAL_MAX_COBS_BUF_SIZE); + return ret; } @@ -724,6 +727,9 @@ z_result_t _z_open_serial_from_dev(_z_sys_net_socket_t *sock, char *dev, uint32_ return _Z_ERR_GENERIC; } + sock->tmp_buf = (uint8_t *)z_malloc(_Z_SERIAL_MFS_SIZE); + sock->raw_buf = (uint8_t *)z_malloc(_Z_SERIAL_MAX_COBS_BUF_SIZE); + return _z_connect_serial(*sock); } @@ -778,7 +784,6 @@ size_t _z_read_serial_internal(const _z_sys_net_socket_t sock, uint8_t *header, size_t _z_send_serial_internal(const _z_sys_net_socket_t sock, uint8_t header, const uint8_t *ptr, size_t len) { size_t ret = _z_serial_msg_serialize(sock.raw_buf, _Z_SERIAL_MAX_COBS_BUF_SIZE, ptr, len, header, sock.tmp_buf, _Z_SERIAL_MFS_SIZE); - if (ret == SIZE_MAX) { return ret; }