1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Update DCCEXParser.cpp

LCD lines added to display power commands and ACK settings, when updated.
Also new command <D ACK RETRY 1>.
This commit is contained in:
Ash-4 2021-08-21 00:23:34 -05:00 committed by GitHub
parent 8ca4011cb0
commit 34d2ab3543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,7 @@ const int16_t HASH_KEYWORD_LIMIT = 27413;
const int16_t HASH_KEYWORD_MAX = 16244; const int16_t HASH_KEYWORD_MAX = 16244;
const int16_t HASH_KEYWORD_MIN = 15978; const int16_t HASH_KEYWORD_MIN = 15978;
const int16_t HASH_KEYWORD_RESET = 26133; const int16_t HASH_KEYWORD_RESET = 26133;
const int16_t HASH_KEYWORD_RETRY = 25704;
const int16_t HASH_KEYWORD_SPEED28 = -17064; const int16_t HASH_KEYWORD_SPEED28 = -17064;
const int16_t HASH_KEYWORD_SPEED128 = 25816; const int16_t HASH_KEYWORD_SPEED128 = 25816;
#ifdef HAS_ENOUGH_MEMORY #ifdef HAS_ENOUGH_MEMORY
@ -464,6 +465,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
if (mode == POWERMODE::OFF) if (mode == POWERMODE::OFF)
DCC::setProgTrackBoost(false); // Prog track boost mode will not outlive prog track off DCC::setProgTrackBoost(false); // Prog track boost mode will not outlive prog track off
StringFormatter::send(stream, F("<p%c>\n"), opcode); StringFormatter::send(stream, F("<p%c>\n"), opcode);
StringFormatter::lcd(2, F("p%c"), opcode);
return; return;
} }
switch (p[0]) switch (p[0])
@ -471,6 +473,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
case HASH_KEYWORD_MAIN: case HASH_KEYWORD_MAIN:
DCCWaveform::mainTrack.setPowerMode(mode); DCCWaveform::mainTrack.setPowerMode(mode);
StringFormatter::send(stream, F("<p%c MAIN>\n"), opcode); StringFormatter::send(stream, F("<p%c MAIN>\n"), opcode);
StringFormatter::lcd(2, F("p%c MAIN"), opcode);
return; return;
case HASH_KEYWORD_PROG: case HASH_KEYWORD_PROG:
@ -478,6 +481,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
if (mode == POWERMODE::OFF) if (mode == POWERMODE::OFF)
DCC::setProgTrackBoost(false); // Prog track boost mode will not outlive prog track off DCC::setProgTrackBoost(false); // Prog track boost mode will not outlive prog track off
StringFormatter::send(stream, F("<p%c PROG>\n"), opcode); StringFormatter::send(stream, F("<p%c PROG>\n"), opcode);
StringFormatter::lcd(2, F("p%c PROG"), opcode);
return; return;
case HASH_KEYWORD_JOIN: case HASH_KEYWORD_JOIN:
DCCWaveform::mainTrack.setPowerMode(mode); DCCWaveform::mainTrack.setPowerMode(mode);
@ -486,9 +490,13 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
{ {
DCC::setProgTrackSyncMain(true); DCC::setProgTrackSyncMain(true);
StringFormatter::send(stream, F("<p1 JOIN>\n"), opcode); StringFormatter::send(stream, F("<p1 JOIN>\n"), opcode);
StringFormatter::lcd(2, F("p1 JOIN"));
} }
else else
{
StringFormatter::send(stream, F("<p0>\n")); StringFormatter::send(stream, F("<p0>\n"));
StringFormatter::lcd(2, F("p0"));
}
return; return;
} }
break; break;
@ -755,17 +763,20 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
StringFormatter::send(stream, F("Free memory=%d\n"), minimumFreeMemory()); StringFormatter::send(stream, F("Free memory=%d\n"), minimumFreeMemory());
break; break;
case HASH_KEYWORD_ACK: // <D ACK ON/OFF> <D ACK [LIMIT|MIN|MAX] Value> case HASH_KEYWORD_ACK: // <D ACK ON/OFF> <D ACK [LIMIT|MIN|MAX|RETRY] Value>
if (params >= 3) { if (params >= 3) {
if (p[1] == HASH_KEYWORD_LIMIT) { if (p[1] == HASH_KEYWORD_LIMIT) {
DCCWaveform::progTrack.setAckLimit(p[2]); DCCWaveform::progTrack.setAckLimit(p[2]);
StringFormatter::send(stream, F("Ack limit=%dmA\n"), p[2]); StringFormatter::lcd(1, F("Ack Limit=%dmA"), p[2]); // <D ACK LIMIT 42>
} else if (p[1] == HASH_KEYWORD_MIN) { } else if (p[1] == HASH_KEYWORD_MIN) {
DCCWaveform::progTrack.setMinAckPulseDuration(p[2]); DCCWaveform::progTrack.setMinAckPulseDuration(p[2]);
StringFormatter::send(stream, F("Ack min=%dus\n"), p[2]); StringFormatter::lcd(0, F("Ack Min=%dus"), p[2]); // <D ACK MIN 1500>
} else if (p[1] == HASH_KEYWORD_MAX) { } else if (p[1] == HASH_KEYWORD_MAX) {
DCCWaveform::progTrack.setMaxAckPulseDuration(p[2]); DCCWaveform::progTrack.setMaxAckPulseDuration(p[2]);
StringFormatter::send(stream, F("Ack max=%dus\n"), p[2]); StringFormatter::lcd(0, F("Ack Max=%dus"), p[2]); // <D ACK MAX 9000>
} else if (p[1] == HASH_KEYWORD_RETRY) {
DCC::setAckRetry(p[2]);
StringFormatter::lcd(0, F("Ack Retry=%d"), p[2]); // <D ACK RETRY 2>
} }
} else { } else {
StringFormatter::send(stream, F("Ack diag %S\n"), onOff ? F("on") : F("off")); StringFormatter::send(stream, F("Ack diag %S\n"), onOff ? F("on") : F("off"));