mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 13:21:23 +01:00
ACK RETRY
ACK retry code added to ackManagerSetup and callback. The default is <D ACK RETRY 1>. For ACK tuning, set retry to zero. Retry count is captured on the LCD display, and lines in the serial monitor.
This commit is contained in:
parent
b67027a1ed
commit
11cd216017
15
DCC.cpp
15
DCC.cpp
@ -679,9 +679,13 @@ int DCC::nextLoco = 0;
|
|||||||
|
|
||||||
//ACK MANAGER
|
//ACK MANAGER
|
||||||
ackOp const * DCC::ackManagerProg;
|
ackOp const * DCC::ackManagerProg;
|
||||||
|
ackOp const * DCC::ackManagerProgStart;
|
||||||
byte DCC::ackManagerByte;
|
byte DCC::ackManagerByte;
|
||||||
byte DCC::ackManagerStash;
|
byte DCC::ackManagerStash;
|
||||||
int DCC::ackManagerWord;
|
int DCC::ackManagerWord;
|
||||||
|
int DCC::ackManagerRetry;
|
||||||
|
int DCC::ackRetry = 1;
|
||||||
|
int DCC::ackRetrySum;
|
||||||
int DCC::ackManagerCv;
|
int DCC::ackManagerCv;
|
||||||
byte DCC::ackManagerBitNum;
|
byte DCC::ackManagerBitNum;
|
||||||
bool DCC::ackReceived;
|
bool DCC::ackReceived;
|
||||||
@ -714,6 +718,8 @@ void DCC::ackManagerSetup(int cv, byte byteValueOrBitnum, ackOp const program[]
|
|||||||
|
|
||||||
ackManagerCv = cv;
|
ackManagerCv = cv;
|
||||||
ackManagerProg = program;
|
ackManagerProg = program;
|
||||||
|
ackManagerProgStart = program;
|
||||||
|
ackManagerRetry = ackRetry;
|
||||||
ackManagerByte = byteValueOrBitnum;
|
ackManagerByte = byteValueOrBitnum;
|
||||||
ackManagerBitNum=byteValueOrBitnum;
|
ackManagerBitNum=byteValueOrBitnum;
|
||||||
ackManagerCallback = callback;
|
ackManagerCallback = callback;
|
||||||
@ -897,6 +903,15 @@ void DCC::ackManagerLoop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DCC::callback(int value) {
|
void DCC::callback(int value) {
|
||||||
|
// check for automatic retry
|
||||||
|
if (value == -1 && ackManagerRetry > 0) {
|
||||||
|
ackRetrySum ++;
|
||||||
|
StringFormatter::lcd(0, F("%d %d %d %d %d %d"), ackManagerCv, ackManagerRetry, ackRetry, ackRetrySum, ackManagerProg, ackManagerProgStart);
|
||||||
|
ackManagerRetry -= 1;
|
||||||
|
ackManagerProg = ackManagerProgStart;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned long callbackStart;
|
static unsigned long callbackStart;
|
||||||
// We are about to leave programming mode
|
// We are about to leave programming mode
|
||||||
// Rule 1: If we have written to a decoder we must maintain power for 100mS
|
// Rule 1: If we have written to a decoder we must maintain power for 100mS
|
||||||
|
Loading…
Reference in New Issue
Block a user