updated the examples to reflect the removal of support for the two call-back functions: notifyDccAccState(), notifyDccSigState()

This commit is contained in:
Alex Shepherd
2018-03-01 00:00:15 +13:00
parent ec801bf463
commit 369786325f
6 changed files with 32 additions and 53 deletions

View File

@@ -370,24 +370,20 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) { extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
uint16_t Current_Decoder_Addr; uint16_t Current_Decoder_Addr = Dcc.getAddr();
uint8_t Bit_State;
Current_Decoder_Addr = Dcc.getAddr();
Bit_State = OutputAddr & 0x01;
if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16 if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16
#ifdef DEBUG #ifdef DEBUG
Serial.print("Addr = "); Serial.print("Addr = ");
Serial.println(Addr); Serial.println(Addr);
Serial.print("BoardAddr = "); Serial.print("Direction = ");
Serial.println(BoardAddr); Serial.println(Direction);
Serial.print("Bit_State = ");
Serial.println(Bit_State);
#endif #endif
exec_function(Addr-Current_Decoder_Addr, Bit_State ); exec_function(Addr-Current_Decoder_Addr, Direction );
} }
} }
void exec_function (int function, int FuncState) { void exec_function (int function, int FuncState) {
byte pin; byte pin;
int servo_temp; int servo_temp;

View File

@@ -370,24 +370,20 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) { extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
uint16_t Current_Decoder_Addr; uint16_t Current_Decoder_Addr = Dcc.getAddr();
uint8_t Bit_State;
Current_Decoder_Addr = Dcc.getAddr();
Bit_State = OutputAddr & 0x01;
if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16 if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16
#ifdef DEBUG #ifdef DEBUG
Serial.print("Addr = "); Serial.print("Addr = ");
Serial.println(Addr); Serial.println(Addr);
Serial.print("BoardAddr = "); Serial.print("Direction = ");
Serial.println(BoardAddr); Serial.println(Direction);
Serial.print("Bit_State = ");
Serial.println(Bit_State);
#endif #endif
exec_function(Addr-Current_Decoder_Addr, Bit_State ); exec_function(Addr-Current_Decoder_Addr, Direction );
} }
} }
void exec_function (int function, int FuncState) { void exec_function (int function, int FuncState) {
byte pin; byte pin;
int servo_temp; int servo_temp;

View File

@@ -93,9 +93,8 @@ void loop()
// You MUST call the NmraDcc.process() method frequently from the Arduino loop() function for correct library operation // You MUST call the NmraDcc.process() method frequently from the Arduino loop() function for correct library operation
Dcc.process(); Dcc.process();
} }
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) { extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
uint8_t Bit_State = OutputAddr & 0x01;
if ( Addr >= This_Decoder_Address && Addr < This_Decoder_Address+17) //Controls This_Decoder_Address+16 if ( Addr >= This_Decoder_Address && Addr < This_Decoder_Address+17) //Controls This_Decoder_Address+16
digitalWrite( ledpins[Addr-This_Decoder_Address], Bit_State ); digitalWrite( ledpins[Addr-This_Decoder_Address], Direction );
} }

View File

@@ -370,24 +370,20 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) { extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
uint16_t Current_Decoder_Addr; uint16_t Current_Decoder_Addr = Dcc.getAddr();
uint8_t Bit_State;
Current_Decoder_Addr = Dcc.getAddr();
Bit_State = OutputAddr & 0x01;
if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16 if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16
#ifdef DEBUG #ifdef DEBUG
Serial.print("Addr = "); Serial.print("Addr = ");
Serial.println(Addr); Serial.println(Addr);
Serial.print("BoardAddr = "); Serial.print("Direction = ");
Serial.println(BoardAddr); Serial.println(Direction);
Serial.print("Bit_State = ");
Serial.println(Bit_State);
#endif #endif
exec_function(Addr-Current_Decoder_Addr, Bit_State ); exec_function(Addr-Current_Decoder_Addr, Direction );
} }
} }
void exec_function (int function, int FuncState) { void exec_function (int function, int FuncState) {
byte pin; byte pin;
int servo_temp; int servo_temp;

View File

@@ -352,24 +352,20 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) { extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
uint16_t Current_Decoder_Addr; uint16_t Current_Decoder_Addr = Dcc.getAddr();
uint8_t Bit_State;
Current_Decoder_Addr = Dcc.getAddr();
Bit_State = OutputAddr & 0x01;
if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16 if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16
#ifdef DEBUG #ifdef DEBUG
Serial.print("Addr = "); Serial.print("Addr = ");
Serial.println(Addr); Serial.println(Addr);
Serial.print("BoardAddr = "); Serial.print("Direction = ");
Serial.println(BoardAddr); Serial.println(Direction);
Serial.print("Bit_State = ");
Serial.println(Bit_State);
#endif #endif
exec_function(Addr-Current_Decoder_Addr, Bit_State ); exec_function(Addr-Current_Decoder_Addr, Direction );
} }
} }
void exec_function (int function, int FuncState) { void exec_function (int function, int FuncState) {
byte pin; byte pin;
int servo_temp; int servo_temp;

View File

@@ -370,24 +370,20 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) { extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
uint16_t Current_Decoder_Addr; uint16_t Current_Decoder_Addr = Dcc.getAddr();
uint8_t Bit_State;
Current_Decoder_Addr = Dcc.getAddr();
Bit_State = OutputAddr & 0x01;
if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16 if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16
#ifdef DEBUG #ifdef DEBUG
Serial.print("Addr = "); Serial.print("Addr = ");
Serial.println(Addr); Serial.println(Addr);
Serial.print("BoardAddr = "); Serial.print("Direction = ");
Serial.println(BoardAddr); Serial.println(Direction);
Serial.print("Bit_State = ");
Serial.println(Bit_State);
#endif #endif
exec_function(Addr-Current_Decoder_Addr, Bit_State ); exec_function(Addr-Current_Decoder_Addr, Direction );
} }
} }
void exec_function (int function, int FuncState) { void exec_function (int function, int FuncState) {
byte pin; byte pin;
int servo_temp; int servo_temp;