-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Hi there,
first of all: great work! Thank you very much for this!
I am using the lib in Decoder Adress Mode.
For some reasons decoder adresses using adress bit A6
(RCN-213 1-0-A7-A6 - A5-A4-A3-A2 | 1-/A10-/A9-/A8 - D-A1-A0-R)
do not raise a callback.
Such as
10001100|11111000 raises the notifyDccAccTurnoutBoard: C,0,0,1
10100000|11111000 raises the notifyDccAccTurnoutBoard: 20,0,0,1
(notifyDccMsg is raised)
but
10010000|11111000 doesn't?
(The notifyDccMsg is not raised also)
I don't know if it is an issue of the lib or an issue in my code.
The lowlevel-track-signal meets correcly the bit pattern mentioned above.
(tested with oscilloscope and several different other softwaretools)
Could you give me a hint what might go wrong.
Regards
Fabian
cpp-File:
#include "DCC_Sniffer.h"
void setup()
{
Serial.begin(BAUDRATE);
Serial.println("NMRA DCC Example 1");
Dcc.pin(0, DCC_PIN, 1);
Dcc.init( MAN_ID_DIY, 10, CV29_ACCESSORY_DECODER, 0 );
Serial.println("Init Done");
}
void loop()
{
Dcc.process();
if( FactoryDefaultCVIndex && Dcc.isSetCVReady())
{
FactoryDefaultCVIndex--; // Decrement first as initially it is the size of the array
Dcc.setCV( FactoryDefaultCVs[FactoryDefaultCVIndex].CV, FactoryDefaultCVs[FactoryDefaultCVIndex].Value);
}
}
h-File;
#ifndef DCC_Sniffer_H
#define DCC_Sniffer_H DCC_Sniffer_H
#include "Arduino.h"
#include <NmraDcc.h>
NmraDcc Dcc ;
DCC_MSG Packet ;
#define DCC_PIN 2
struct CVPair
{
uint16_t CV;
uint8_t Value;
};
CVPair FactoryDefaultCVs [] =
{
{CV_ACCESSORY_DECODER_ADDRESS_LSB, DEFAULT_ACCESSORY_DECODER_ADDRESS & 0xFF},
{CV_ACCESSORY_DECODER_ADDRESS_MSB, DEFAULT_ACCESSORY_DECODER_ADDRESS >> 8},
};
uint8_t FactoryDefaultCVIndex = 0;
void notifyDccMsg( DCC_MSG * Msg)
{
//Serial.print("notifyDccMsg: ") ;
//for(uint8_t i = 0; i < Msg->Size; i++)
// {
// Serial.print(Msg->Data[i], HEX);
// Serial.write(' ');
//}
}
void notifyCVAck(void)
{
Serial.println("notifyCVAck") ;
}
// This function is called whenever a normal DCC Turnout Packet is received and we're in Board Addressing Mode
void notifyDccAccTurnoutBoard( uint16_t BoardAddr, uint8_t OutputPair, uint8_t Direction, uint8_t OutputPower )
{
Serial.print("notifyDccAccTurnoutBoard: ") ;
Serial.print(BoardAddr,HEX) ;
Serial.print(',');
Serial.print(OutputPair,DEC) ;
Serial.print(',');
Serial.print(Direction,DEC) ;
Serial.print(',');
Serial.println(OutputPower, HEX) ;
}
}