kopia lustrzana https://github.com/espressif/esp-idf
freemodbuss: fix event processing after merge
rodzic
fc8dc69d3c
commit
868e123336
|
@ -324,6 +324,7 @@ eMBMasterPoll( void )
|
||||||
* Otherwise we will handle the event. */
|
* Otherwise we will handle the event. */
|
||||||
if ( xMBMasterPortEventGet( &eEvent ) == TRUE )
|
if ( xMBMasterPortEventGet( &eEvent ) == TRUE )
|
||||||
{
|
{
|
||||||
|
while( eEvent ) {
|
||||||
// In some cases it is possible that more than one event set
|
// In some cases it is possible that more than one event set
|
||||||
// together (even from one subset mask) than process them consistently
|
// together (even from one subset mask) than process them consistently
|
||||||
if ( MB_PORT_CHECK_EVENT( eEvent, EV_MASTER_READY ) ) {
|
if ( MB_PORT_CHECK_EVENT( eEvent, EV_MASTER_READY ) ) {
|
||||||
|
@ -354,7 +355,6 @@ eMBMasterPoll( void )
|
||||||
( void ) xMBMasterPortEventPost( EV_MASTER_EXECUTE );
|
( void ) xMBMasterPortEventPost( EV_MASTER_EXECUTE );
|
||||||
ESP_LOGD(MB_PORT_TAG, "%s: Packet data received successfully (%u).", __func__, eStatus);
|
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);
|
ESP_LOG_BUFFER_HEX_LEVEL("POLL receive buffer", (void*)ucMBFrame, (uint16_t)usLength, ESP_LOG_DEBUG);
|
||||||
( void ) xMBMasterPortEventPost( EV_MASTER_EXECUTE );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -453,11 +453,6 @@ eMBMasterPoll( void )
|
||||||
MB_PORT_CLEAR_EVENT( eEvent, EV_MASTER_ERROR_PROCESS );
|
MB_PORT_CLEAR_EVENT( eEvent, EV_MASTER_ERROR_PROCESS );
|
||||||
vMBMasterRunResRelease( );
|
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 {
|
} else {
|
||||||
// Something went wrong and task unblocked but there are no any correct events set
|
// Something went wrong and task unblocked but there are no any correct events set
|
||||||
|
|
Ładowanie…
Reference in New Issue