fixed call-back function void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) to include the new parameter: DCC_ADDR_TYPE AddrType

This commit is contained in:
Alex Shepherd
2016-03-20 20:45:33 +13:00
parent c4e693550c
commit 8dc6ee950f
11 changed files with 21 additions and 25 deletions

View File

@@ -68,7 +68,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -407,7 +406,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1

View File

@@ -68,7 +68,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -407,7 +406,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1

View File

@@ -68,7 +68,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -407,7 +406,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1

View File

@@ -33,7 +33,6 @@ DCC_MSG Packet ;
#define This_Decoder_Address 17 #define This_Decoder_Address 17
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -89,7 +88,7 @@ void loop()
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState)
{ {
switch(FuncGrp) switch(FuncGrp)
{ {

View File

@@ -68,7 +68,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -407,7 +406,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1

View File

@@ -67,7 +67,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -416,7 +415,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, uint8_t FuncNum, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
if (FuncNum==1) { //Function Group 1 F0 F4 F3 F2 F1 if (FuncNum==1) { //Function Group 1 F0 F4 F3 F2 F1
exec_function( 0, FunctionPin0, (FuncState&0x10)>>4 ); exec_function( 0, FunctionPin0, (FuncState&0x10)>>4 );
exec_function( 1, FunctionPin1, (FuncState&0x01 )); exec_function( 1, FunctionPin1, (FuncState&0x01 ));

View File

@@ -71,7 +71,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -420,7 +419,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1

View File

@@ -85,7 +85,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -470,7 +469,7 @@ void gobwd2(int bcnt,int bcycle) {
icnt++; icnt++;
} }
} }
extern void notifyDccSpeed( uint16_t Addr, uint8_t Speed, uint8_t ForwardDir, uint8_t MaxSpeed ) { void notifyDccSpeed( uint16_t Addr, uint8_t Speed, uint8_t ForwardDir, uint8_t MaxSpeed ) {
if (Function13_value==1) { if (Function13_value==1) {
Motor1Speed = Speed; Motor1Speed = Speed;
Motor1ForwardDir = ForwardDir; Motor1ForwardDir = ForwardDir;
@@ -482,7 +481,7 @@ extern void notifyDccSpeed( uint16_t Addr, uint8_t Speed, uint8_t ForwardDir, ui
Motor2MaxSpeed = MaxSpeed; Motor2MaxSpeed = MaxSpeed;
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1
@@ -669,4 +668,5 @@ void detach_servo (int servo_num) {
default: default:
break; break;
} }
} }

View File

@@ -68,7 +68,6 @@ struct QUEUE
}; };
QUEUE *ftn_queue = new QUEUE[16]; QUEUE *ftn_queue = new QUEUE[16];
extern uint8_t Decoder_Address = This_Decoder_Address;
struct CVPair struct CVPair
{ {
uint16_t CV; uint16_t CV;
@@ -407,7 +406,7 @@ void loop() //****************************************************************
} }
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
switch(FuncGrp) switch(FuncGrp)
{ {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1

View File

@@ -101,7 +101,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 notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) {
void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
int f_index; int f_index;
switch (FuncGrp) { switch (FuncGrp) {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1
@@ -145,7 +146,8 @@ void exec_function (int f_index, int FuncState) {
Set_LED (f_index,false); Set_LED (f_index,false);
} }
} }
extern void notifyDccSpeed( uint16_t Addr, uint8_t Speed, uint8_t ForwardDir, uint8_t MaxSpeed ) {
void notifyDccSpeed( uint16_t Addr, uint8_t Speed, uint8_t ForwardDir, uint8_t MaxSpeed ) {
Last_Decoder_direction = Decoder_direction; Last_Decoder_direction = Decoder_direction;
Decoder_direction = ForwardDir; Decoder_direction = ForwardDir;
if ( Decoder_direction==Last_Decoder_direction) return; if ( Decoder_direction==Last_Decoder_direction) return;
@@ -196,4 +198,5 @@ void Switch_LED (int Function) {
delayMicroseconds (1000.*time_fraction); delayMicroseconds (1000.*time_fraction);
} }
led_last_state[Function] = end_state; led_last_state[Function] = end_state;
} }

View File

@@ -123,7 +123,7 @@ void loop()
Dcc.process(); Dcc.process();
} }
extern void notifyDccFunc( uint16_t Addr, FN_GROUP FuncGrp, uint8_t FuncState) { void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP FuncGrp, uint8_t FuncState) {
int f_index; int f_index;
switch (FuncGrp) { switch (FuncGrp) {
case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1 case FN_0_4: //Function Group 1 F0 F4 F3 F2 F1
@@ -172,4 +172,5 @@ void exec_function (int f_index, int FuncState) {
Last_Function_State[f_index] = false; Last_Function_State[f_index] = false;
} }
} }