From 67813520f68c58114f216410ec91d67dee836e8f Mon Sep 17 00:00:00 2001 From: lexus2k Date: Fri, 26 Jul 2024 21:48:27 +0400 Subject: [PATCH] Small fixes ports for compilation and connection re-establish --- CMakeLists.txt | 2 +- src/hal/esp32/esp32_hal.inl | 2 ++ src/proto/fd/tiny_fd.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66e3d802..cce1f46c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ if (NOT DEFINED COMPONENT_DIR) else() idf_component_register(SRCS ${SOURCE_FILES} - INCLUDE_DIRS "src") + INCLUDE_DIRS "src" PRIV_REQUIRES esp_timer) endif() diff --git a/src/hal/esp32/esp32_hal.inl b/src/hal/esp32/esp32_hal.inl index 005d2db6..552b7726 100644 --- a/src/hal/esp32/esp32_hal.inl +++ b/src/hal/esp32/esp32_hal.inl @@ -26,6 +26,8 @@ For further information contact via email on github account. */ +#include "esp_timer.h" + void tiny_mutex_create(tiny_mutex_t *mutex) { *mutex = xSemaphoreCreateMutex(); diff --git a/src/proto/fd/tiny_fd.c b/src/proto/fd/tiny_fd.c index 4c489226..7dd50534 100644 --- a/src/proto/fd/tiny_fd.c +++ b/src/proto/fd/tiny_fd.c @@ -510,6 +510,10 @@ static int __on_u_frame_read(tiny_fd_handle_t handle, uint8_t peer, void *data, .control = HDLC_U_FRAME_TYPE_UA | HDLC_U_FRAME_BITS, }; __put_u_s_frame_to_tx_queue(handle, TINY_FD_QUEUE_U_FRAME, &frame, 2); + if ( handle->peers[peer].state == TINY_FD_STATE_CONNECTED ) + { + __switch_to_disconnected_state(handle, peer); + } __switch_to_connected_state(handle, peer); } else if ( type == HDLC_U_FRAME_TYPE_DISC )