Merge branch 'ESU_ECoS_CV_Programming'

* ESU_ECoS_CV_Programming:
  Added ESU ECoS CV Programming support
This commit is contained in:
Alex Shepherd
2017-12-24 15:25:17 +13:00

View File

@@ -981,6 +981,24 @@ void execDccProcessor( DCC_MSG * pDccMsg )
Address = ( ( ( BoardAddress - 1 ) << 2 ) | OutputIndex ) + 1 ;
if( pDccMsg->Size == 6 && (pDccMsg->Data[2] & 0b11100000) == 0b11100000 && (pDccMsg->Data[1] & 0b00001111) == 0 )
{
// Accessory CV programming, program entire decoder
// Process only if it is our board address or a broadcast
// (even if we have more than one address on this decoder,
// CV programming is allowed only for address defined in CV1/CV9)
if( BoardAddress == getMyAddr() || BoardAddress == 511 )
{
uint16_t CVAddr = ( ( ( pDccMsg->Data[2] & 0x03 ) << 8 ) | pDccMsg->Data[3] ) + 1 ;
uint8_t Value = pDccMsg->Data[4] ;
processDirectOpsOperation( pDccMsg->Data[2] & 0b00001100, CVAddr, Value ) ;
}
}
else
{
if(pDccMsg->Data[1] & 0b10000000)
{
uint8_t direction = OutputAddress & 0x01;
@@ -1003,6 +1021,7 @@ void execDccProcessor( DCC_MSG * pDccMsg )
}
}
}
}
#ifdef NMRA_DCC_PROCESS_MULTIFUNCTION
// Multi Function Decoders (14-bit address)