Update NmraDcc.cpp (#28)

Changed the Service Mode duplicate packet comparison to only compare the packet Size and  Data fields and ignore the number of Preamble bits as some command stations appear to send different numbers of preamble bits for otherwise duplicated packets, so we detecting the required two identical packets in sequence and performing the ServiceMode Operation
This commit is contained in:
Roeland
2019-08-19 08:59:29 +02:00
committed by Alex Shepherd
parent 462025b9fe
commit 794128fe4b

View File

@@ -1096,7 +1096,8 @@ void execDccProcessor( DCC_MSG * pDccMsg )
{ {
resetServiceModeTimer( 1 ) ; resetServiceModeTimer( 1 ) ;
if( memcmp( pDccMsg, &DccProcState.LastMsg, sizeof( DCC_MSG ) ) ) //Check if size and data content of the DCC match with previous packed
if(pDccMsg->Size != DccProcState.LastMsg.Size || memcmp( pDccMsg->Data, &DccProcState.LastMsg.Data, pDccMsg->Size ) != 0 )
{ {
DccProcState.DuplicateCount = 0 ; DccProcState.DuplicateCount = 0 ;
memcpy( &DccProcState.LastMsg, pDccMsg, sizeof( DCC_MSG ) ) ; memcpy( &DccProcState.LastMsg, pDccMsg, sizeof( DCC_MSG ) ) ;