1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

ack diag better messages

This commit is contained in:
Harald Barth 2020-11-24 21:12:55 +01:00
parent 258113c580
commit 3faa48476c
2 changed files with 9 additions and 4 deletions

View File

@ -49,6 +49,8 @@ const int HASH_KEYWORD_PROGBOOST = -6353;
const int HASH_KEYWORD_EEPROM = -7168;
const int HASH_KEYWORD_LIMIT = 27413;
const int HASH_KEYWORD_ETHERNET = -30767;
//const int HASH_KEYWORD_MAX = 16244;
//const int HASH_KEYWORD_MIN = 15978;
int DCCEXParser::stashP[MAX_PARAMS];
bool DCCEXParser::stashBusy;
@ -598,8 +600,10 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[])
if (params >= 2 && p[1] == HASH_KEYWORD_LIMIT) {
DCCWaveform::progTrack.setAckLimit(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;
}
return true;
case HASH_KEYWORD_CMD: // <D CMD ON/OFF>

View File

@ -295,9 +295,10 @@ void DCCWaveform::setAckBaseline() {
if (isMainTrack) return;
int baseline = motorDriver->getCurrentRaw();
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),
ackThreshold,motorDriver->raw2mA(ackThreshold));
ackThreshold,motorDriver->raw2mA(ackThreshold),
MIN_ACK_PULSE_DURATION, MAX_ACK_PULSE_DURATION);
}
void DCCWaveform::setAckPending() {
@ -312,7 +313,7 @@ void DCCWaveform::setAckPending() {
byte DCCWaveform::getAck() {
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);
if (ackDetected) return (1); // Yes we had an ack
return(0); // pending set off but not detected means no ACK.