freemodbuss: fix event processing after merge
@@ -324,6 +324,7 @@ eMBMasterPoll( void )
* Otherwise we will handle the event. */
if ( xMBMasterPortEventGet( &eEvent ) == TRUE )
{
+ while( eEvent ) {
// In some cases it is possible that more than one event set
// together (even from one subset mask) than process them consistently
if ( MB_PORT_CHECK_EVENT( eEvent, EV_MASTER_READY ) ) {
@@ -354,7 +355,6 @@ eMBMasterPoll( void )
( void ) xMBMasterPortEventPost( EV_MASTER_EXECUTE );
ESP_LOGD(MB_PORT_TAG, "%s: Packet data received successfully (%u).", __func__, eStatus);
ESP_LOG_BUFFER_HEX_LEVEL("POLL receive buffer", (void*)ucMBFrame, (uint16_t)usLength, ESP_LOG_DEBUG);
- ( void ) xMBMasterPortEventPost( EV_MASTER_EXECUTE );
}
else
{
@@ -453,11 +453,6 @@ eMBMasterPoll( void )
MB_PORT_CLEAR_EVENT( eEvent, EV_MASTER_ERROR_PROCESS );
vMBMasterRunResRelease( );
}
- if ( eEvent ) {
- // Event processing is done, but some poll events still set then
- // postpone its processing for next poll cycle (rare case).
- ESP_LOGW( MB_PORT_TAG, "%s: Postpone event %x.", __func__, eEvent );
- ( void ) xMBMasterPortEventPost( eEvent );
}
} else {
// Something went wrong and task unblocked but there are no any correct events set
