From fc8a50297d435ade8d8325c62744d84c409990d2 Mon Sep 17 00:00:00 2001 From: Alex Lisitsyn Date: Thu, 27 Oct 2022 15:48:19 +0800 Subject: [PATCH] Bugfix/fix resource release failure --- freemodbus/port/portevent_m.c | 9 ++++++--- idf_component.yml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/freemodbus/port/portevent_m.c b/freemodbus/port/portevent_m.c index 79dbca3..0f680be 100644 --- a/freemodbus/port/portevent_m.c +++ b/freemodbus/port/portevent_m.c @@ -187,13 +187,16 @@ BOOL xMBMasterRunResTake( LONG lTimeOut ) /** * This function is release Modbus Master running resource. - * Note:The resource is define by Operating System.If you not use OS this function can be empty. + * Note:The resource is define by Operating System. If you not use OS this function can be empty. */ void vMBMasterRunResRelease( void ) { EventBits_t uxBits = xEventGroupSetBits( xResourceMasterHdl, MB_EVENT_RESOURCE ); - MB_PORT_CHECK((uxBits == MB_EVENT_RESOURCE), ; , "Resource release failure."); - ESP_LOGD(MB_PORT_TAG,"%s: Release resource (%x).", __func__, uxBits); + if (uxBits != MB_EVENT_RESOURCE) { + // The returned resource mask may be = 0, if the task waiting for it is unblocked. + // This is not an error but expected behavior. + ESP_LOGD(MB_PORT_TAG,"%s: Release resource (%x) fail.", __func__, uxBits); + } } /** diff --git a/idf_component.yml b/idf_component.yml index 17cb24d..7b3fefd 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.4" +version: "1.0.5" description: ESP-MODBUS is the official Modbus library for Espressif SoCs. url: https://github.com/espressif/esp-modbus dependencies: