From 940e108c4b5b90ae2d4bbdb6207078d383e59702 Mon Sep 17 00:00:00 2001 From: aleks Date: Wed, 13 May 2020 15:59:36 +0200 Subject: [PATCH] freemodbus: fix event processing failure after destroy Closes https://github.com/espressif/esp-idf/issues/5275 --- components/freemodbus/port/portevent_m.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/freemodbus/port/portevent_m.c b/components/freemodbus/port/portevent_m.c index 33814ebe72..1c990005f9 100644 --- a/components/freemodbus/port/portevent_m.c +++ b/components/freemodbus/port/portevent_m.c @@ -274,7 +274,12 @@ eMBMasterReqErrCode eMBMasterWaitRequestFinish( void ) { } } else { ESP_LOGE(MB_PORT_TAG,"%s: Incorrect event or timeout xRecvedEvent = 0x%x", __func__, uxBits); - assert(0); + // https://github.com/espressif/esp-idf/issues/5275 + // if a no event is received, that means vMBMasterPortEventClose() + // has been closed, so event group has been deleted by FreeRTOS, which + // triggers the send of 0 value to the event group to unlock this task + // waiting on it. For this patch, handles it as a time out without assert. + eErrStatus = MB_MRE_TIMEDOUT; } return eErrStatus; }