manually merged in Franz-Peter's changes as his PR#30 pull-request had too many differences to merge once I'd already solved the advancedAck issue.

This commit contains the remaining relevant changes after doing a manual diff of the library files
This commit is contained in:
Alex Shepherd
2020-01-10 17:33:09 +13:00
parent 5349a21e2e
commit 7819716ac0
2 changed files with 7 additions and 4 deletions

View File

@@ -607,9 +607,9 @@ void ackCV(void)
void ackAdvancedCV(void)
{
if( notifyAdvancedCVAck && (DccProcState.cv29Value & CV29_ADV_ACK) )
if( notifyAdvancedCVAck && (DccProcState.cv29Value & CV29_RAILCOM_ENABLE) )
{
DB_PRINT("ackAdvancedCV: Send Advanced ACK");
DB_PRINT("ackAdvancedCV: Send RailCom ACK");
notifyAdvancedCVAck() ;
}
}
@@ -674,6 +674,8 @@ uint8_t writeCV( unsigned int CV, uint8_t Value)
{
case CV_29_CONFIG:
// copy addressmode Bit to Flags
Value = Value & ~CV29_RAILCOM_ENABLE; // Bidi (RailCom) Bit must not be enabled,
// because you cannot build a Bidi decoder with this lib.
DccProcState.cv29Value = Value;
DccProcState.Flags = ( DccProcState.Flags & ~FLAGS_CV29_BITS) | (Value & FLAGS_CV29_BITS);
// no break, because myDccAdress must also be reset
@@ -1029,6 +1031,7 @@ void processServiceModeOperation( DCC_MSG * pDccMsg )
DB_PRINT("CV Direct Byte and Bit Mode Mode Operation");
CVAddr = ( ( ( pDccMsg->Data[0] & 0x03 ) << 8 ) | pDccMsg->Data[1] ) + 1 ;
Value = pDccMsg->Data[2] ;
processDirectCVOperation( pDccMsg->Data[0] & 0b00001100, CVAddr, Value, ackCV) ;
}
}

View File

@@ -49,7 +49,7 @@
#ifndef NMRADCC_IS_IN
#define NMRADCC_IS_IN
#define NMRADCC_VERSION 201 // Version 2.0.1
#define NMRADCC_VERSION 203 // Version 2.0.3
#define MAX_DCC_MESSAGE_LEN 6 // including XOR-Byte
@@ -118,7 +118,7 @@ typedef enum {
CV29_LOCO_DIR = 0b00000001, /** bit 0: Locomotive Direction: "0" = normal, "1" = reversed */
CV29_F0_LOCATION = 0b00000010, /** bit 1: F0 location: "0" = bit 4 in Speed and Direction instructions, "1" = bit 4 in function group one instruction */
CV29_APS = 0b00000100, /** bit 2: Alternate Power Source (APS) "0" = NMRA Digital only, "1" = Alternate power source set by CV12 */
CV29_ADV_ACK = 0b00001000, /** bit 3: ACK, Advanced Acknowledge mode enabled if 1, disabled if 0 */
CV29_RAILCOM_ENABLE = 0b00001000, /** bit 3: BiDi ( RailCom ) is active */
CV29_SPEED_TABLE_ENABLE = 0b00010000, /** bit 4: STE, Speed Table Enable, "0" = values in CVs 2, 4 and 6, "1" = Custom table selected by CV 25 */
CV29_EXT_ADDRESSING = 0b00100000, /** bit 5: "0" = one byte addressing, "1" = two byte addressing */
CV29_OUTPUT_ADDRESS_MODE = 0b01000000, /** bit 6: "0" = Decoder Address Mode "1" = Output Address Mode */