mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-24 05:11:24 +01:00
ack diag better messages
This commit is contained in:
parent
258113c580
commit
3faa48476c
@ -49,6 +49,8 @@ const int HASH_KEYWORD_PROGBOOST = -6353;
|
|||||||
const int HASH_KEYWORD_EEPROM = -7168;
|
const int HASH_KEYWORD_EEPROM = -7168;
|
||||||
const int HASH_KEYWORD_LIMIT = 27413;
|
const int HASH_KEYWORD_LIMIT = 27413;
|
||||||
const int HASH_KEYWORD_ETHERNET = -30767;
|
const int HASH_KEYWORD_ETHERNET = -30767;
|
||||||
|
//const int HASH_KEYWORD_MAX = 16244;
|
||||||
|
//const int HASH_KEYWORD_MIN = 15978;
|
||||||
|
|
||||||
int DCCEXParser::stashP[MAX_PARAMS];
|
int DCCEXParser::stashP[MAX_PARAMS];
|
||||||
bool DCCEXParser::stashBusy;
|
bool DCCEXParser::stashBusy;
|
||||||
@ -598,8 +600,10 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[])
|
|||||||
if (params >= 2 && p[1] == HASH_KEYWORD_LIMIT) {
|
if (params >= 2 && p[1] == HASH_KEYWORD_LIMIT) {
|
||||||
DCCWaveform::progTrack.setAckLimit(p[2]);
|
DCCWaveform::progTrack.setAckLimit(p[2]);
|
||||||
StringFormatter::send(stream, F("\nAck limit=%dmA\n"), p[2]);
|
StringFormatter::send(stream, F("\nAck limit=%dmA\n"), p[2]);
|
||||||
} else
|
} else {
|
||||||
|
StringFormatter::send(stream, F("\nAck diag %S\n"), onOff ? F("on") : F("off"));
|
||||||
Diag::ACK = onOff;
|
Diag::ACK = onOff;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case HASH_KEYWORD_CMD: // <D CMD ON/OFF>
|
case HASH_KEYWORD_CMD: // <D CMD ON/OFF>
|
||||||
|
@ -295,9 +295,10 @@ void DCCWaveform::setAckBaseline() {
|
|||||||
if (isMainTrack) return;
|
if (isMainTrack) return;
|
||||||
int baseline = motorDriver->getCurrentRaw();
|
int baseline = motorDriver->getCurrentRaw();
|
||||||
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
|
ackThreshold= baseline + motorDriver->mA2raw(ackLimitmA);
|
||||||
if (Diag::ACK) DIAG(F("\nACK baseline=%d/%dmA threshold=%d/%dmA"),
|
if (Diag::ACK) DIAG(F("\nACK baseline=%d/%dmA Threshold=%d/%dmA Duration: %dus <= pulse <= %dus"),
|
||||||
baseline,motorDriver->raw2mA(baseline),
|
baseline,motorDriver->raw2mA(baseline),
|
||||||
ackThreshold,motorDriver->raw2mA(ackThreshold));
|
ackThreshold,motorDriver->raw2mA(ackThreshold),
|
||||||
|
MIN_ACK_PULSE_DURATION, MAX_ACK_PULSE_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DCCWaveform::setAckPending() {
|
void DCCWaveform::setAckPending() {
|
||||||
@ -312,7 +313,7 @@ void DCCWaveform::setAckPending() {
|
|||||||
|
|
||||||
byte DCCWaveform::getAck() {
|
byte DCCWaveform::getAck() {
|
||||||
if (ackPending) return (2); // still waiting
|
if (ackPending) return (2); // still waiting
|
||||||
if (Diag::ACK) DIAG(F("\nACK-%S after %dmS max=%d/%dmA pulse=%duS"),ackDetected?F("OK"):F("FAIL"), ackCheckDuration,
|
if (Diag::ACK) DIAG(F("\n%S after %dmS max=%d/%dmA pulse=%duS"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
|
||||||
ackMaxCurrent,motorDriver->raw2mA(ackMaxCurrent), ackPulseDuration);
|
ackMaxCurrent,motorDriver->raw2mA(ackMaxCurrent), ackPulseDuration);
|
||||||
if (ackDetected) return (1); // Yes we had an ack
|
if (ackDetected) return (1); // Yes we had an ack
|
||||||
return(0); // pending set off but not detected means no ACK.
|
return(0); // pending set off but not detected means no ACK.
|
||||||
|
Loading…
Reference in New Issue
Block a user