mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-28 09:53:45 +02:00
Squashed commit of the following:
commitb34205b142
Merge:8703248
2829716
Author: Neil McKechnie <75813993+Neil-McK@users.noreply.github.com> Date: Mon Aug 23 10:05:54 2021 +0100 Merge branch 'EX-RAIL' into ackRetry commit8703248c49
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sun Aug 22 16:47:38 2021 -0500 ACK RETRY max 255 with fallback to 3 if greater And includes LCD lines for power and ACK diags. commitf5d4522ed7
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sun Aug 22 16:40:13 2021 -0500 ACK RETRY updated datatypes commit1dbf236697
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sun Aug 22 16:35:14 2021 -0500 ACK RETRY updated datatypes commitd93584e9a4
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sun Aug 22 13:16:24 2021 -0500 ACK RETRY updated default is 2 retries. commitf58ebac670
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sat Aug 21 16:43:21 2021 -0500 ACK RETRY is 3 or less (default is 1) commit08350b215a
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sat Aug 21 11:55:17 2021 -0500 ACK RETRY LCD display update. lcd(0, F("RETRY %d %d %d %d"), ackManagerCv, ackManagerRetry, ackRetry, ackRetrySum); commit11cd216017
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sat Aug 21 00:54:28 2021 -0500 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. commitb67027a1ed
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sat Aug 21 00:33:01 2021 -0500 ACK RETRY variables added commit34d2ab3543
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Sat Aug 21 00:23:34 2021 -0500 Update DCCEXParser.cpp LCD lines added to display power commands and ACK settings, when updated. Also new command <D ACK RETRY 1>. commit8ca4011cb0
Author: Ash-4 <81280775+Ash-4@users.noreply.github.com> Date: Fri Aug 20 23:58:13 2021 -0500 Update CommandStation-EX.ino Update LCD row number for Ready and Free RAM. commit6571138389
Author: Harald Barth <haba@kth.se> Date: Sun Aug 1 22:08:34 2021 +0200 optimize command parser for size commitc4f659243e
Author: Harald Barth <haba@kth.se> Date: Sun Aug 1 15:07:06 2021 +0200 optimize for loops for size (and speed) commit55b7091d5a
Author: Harald Barth <haba@kth.se> Date: Sun Aug 1 12:45:29 2021 +0200 take less progmem for messages commit6d7c1925b0
Author: Harald Barth <haba@kth.se> Date: Sun Aug 1 11:56:12 2021 +0200 only pragma -O3 critical functions
This commit is contained in:
@@ -32,6 +32,16 @@
|
||||
#include "DIAG.h"
|
||||
#include <avr/wdt.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Figure out if we have enough memory for advanced features
|
||||
//
|
||||
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO)
|
||||
// nope
|
||||
#else
|
||||
#define HAS_ENOUGH_MEMORY
|
||||
#endif
|
||||
|
||||
// These keywords are used in the <1> command. The number is what you get if you use the keyword as a parameter.
|
||||
// To discover new keyword numbers , use the <$ YOURKEYWORD> command
|
||||
const int16_t HASH_KEYWORD_PROG = -29718;
|
||||
@@ -40,8 +50,6 @@ const int16_t HASH_KEYWORD_JOIN = -30750;
|
||||
const int16_t HASH_KEYWORD_CABS = -11981;
|
||||
const int16_t HASH_KEYWORD_RAM = 25982;
|
||||
const int16_t HASH_KEYWORD_CMD = 9962;
|
||||
const int16_t HASH_KEYWORD_WIT = 31594;
|
||||
const int16_t HASH_KEYWORD_WIFI = -5583;
|
||||
const int16_t HASH_KEYWORD_ACK = 3113;
|
||||
const int16_t HASH_KEYWORD_ON = 2657;
|
||||
const int16_t HASH_KEYWORD_DCC = 6436;
|
||||
@@ -49,17 +57,22 @@ const int16_t HASH_KEYWORD_SLOW = -17209;
|
||||
const int16_t HASH_KEYWORD_PROGBOOST = -6353;
|
||||
const int16_t HASH_KEYWORD_EEPROM = -7168;
|
||||
const int16_t HASH_KEYWORD_LIMIT = 27413;
|
||||
const int16_t HASH_KEYWORD_ETHERNET = -30767;
|
||||
const int16_t HASH_KEYWORD_MAX = 16244;
|
||||
const int16_t HASH_KEYWORD_MIN = 15978;
|
||||
const int16_t HASH_KEYWORD_LCN = 15137;
|
||||
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_SPEED128 = 25816;
|
||||
const int16_t HASH_KEYWORD_SERVO=27709;
|
||||
const int16_t HASH_KEYWORD_VPIN=-415;
|
||||
const int16_t HASH_KEYWORD_C=67;
|
||||
const int16_t HASH_KEYWORD_T=84;
|
||||
const int16_t HASH_KEYWORD_LCN = 15137;
|
||||
#ifdef HAS_ENOUGH_MEMORY
|
||||
const int16_t HASH_KEYWORD_WIFI = -5583;
|
||||
const int16_t HASH_KEYWORD_ETHERNET = -30767;
|
||||
const int16_t HASH_KEYWORD_WIT = 31594;
|
||||
#endif
|
||||
|
||||
int16_t DCCEXParser::stashP[MAX_COMMAND_PARAMS];
|
||||
bool DCCEXParser::stashBusy;
|
||||
@@ -257,6 +270,7 @@ void DCCEXParser::parse(const FSH * cmd) {
|
||||
}
|
||||
|
||||
// See documentation on DCC class for info on this section
|
||||
|
||||
void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
{
|
||||
(void)EEPROM; // tell compiler not to warn this is unused
|
||||
@@ -455,6 +469,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
if (mode == POWERMODE::OFF)
|
||||
DCC::setProgTrackBoost(false); // Prog track boost mode will not outlive prog track off
|
||||
StringFormatter::send(stream, F("<p%c>\n"), opcode);
|
||||
StringFormatter::lcd(2, F("p%c"), opcode);
|
||||
return;
|
||||
}
|
||||
switch (p[0])
|
||||
@@ -462,6 +477,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
case HASH_KEYWORD_MAIN:
|
||||
DCCWaveform::mainTrack.setPowerMode(mode);
|
||||
StringFormatter::send(stream, F("<p%c MAIN>\n"), opcode);
|
||||
StringFormatter::lcd(2, F("p%c MAIN"), opcode);
|
||||
return;
|
||||
|
||||
case HASH_KEYWORD_PROG:
|
||||
@@ -469,6 +485,7 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
if (mode == POWERMODE::OFF)
|
||||
DCC::setProgTrackBoost(false); // Prog track boost mode will not outlive prog track off
|
||||
StringFormatter::send(stream, F("<p%c PROG>\n"), opcode);
|
||||
StringFormatter::lcd(2, F("p%c PROG"), opcode);
|
||||
return;
|
||||
case HASH_KEYWORD_JOIN:
|
||||
DCCWaveform::mainTrack.setPowerMode(mode);
|
||||
@@ -477,9 +494,13 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
|
||||
{
|
||||
DCC::setProgTrackSyncMain(true);
|
||||
StringFormatter::send(stream, F("<p1 JOIN>\n"), opcode);
|
||||
StringFormatter::lcd(2, F("p1 JOIN"));
|
||||
}
|
||||
else
|
||||
{
|
||||
StringFormatter::send(stream, F("<p0>\n"));
|
||||
StringFormatter::lcd(2, F("p0"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -784,17 +805,21 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||
StringFormatter::send(stream, F("Free memory=%d\n"), minimumFreeMemory());
|
||||
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 (p[1] == HASH_KEYWORD_LIMIT) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
if (p[2] >255) p[2]=3;
|
||||
DCC::setAckRetry(p[2]);
|
||||
StringFormatter::lcd(0, F("Ack Retry=%d"), p[2]); // <D ACK RETRY 2>
|
||||
}
|
||||
} else {
|
||||
StringFormatter::send(stream, F("Ack diag %S\n"), onOff ? F("on") : F("off"));
|
||||
@@ -806,21 +831,23 @@ bool DCCEXParser::parseD(Print *stream, int16_t params, int16_t p[])
|
||||
Diag::CMD = onOff;
|
||||
return true;
|
||||
|
||||
#ifdef HAS_ENOUGH_MEMORY
|
||||
case HASH_KEYWORD_WIFI: // <D WIFI ON/OFF>
|
||||
Diag::WIFI = onOff;
|
||||
return true;
|
||||
|
||||
case HASH_KEYWORD_ETHERNET: // <D ETHERNET ON/OFF>
|
||||
case HASH_KEYWORD_ETHERNET: // <D ETHERNET ON/OFF>
|
||||
Diag::ETHERNET = onOff;
|
||||
return true;
|
||||
|
||||
case HASH_KEYWORD_WIT: // <D WIT ON/OFF>
|
||||
Diag::WITHROTTLE = onOff;
|
||||
return true;
|
||||
|
||||
|
||||
case HASH_KEYWORD_LCN: // <D LCN ON/OFF>
|
||||
Diag::LCN = onOff;
|
||||
return true;
|
||||
#endif
|
||||
|
||||
case HASH_KEYWORD_PROGBOOST:
|
||||
DCC::setProgTrackBoost(true);
|
||||
|
Reference in New Issue
Block a user