1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-07-28 09:53:45 +02:00

Assorted bits (#138)

* LCN

* Prevent deprecated compiler warning

* Implement huge function numbers

* new commands

<! [cab]> forget locos.
<9> ESTOP ALL.
<D RESET> reboot arduino

* Waveform accuracy msg

* Drop post-write verify

* UNUSED_PIN current measure

and callback -2 for cv actions.

* Correct diags

* ESTOP a forget loco

* ESTOP loco on forget

* Avoid compiler warning

* current sensor offset

* Restore <1 JOIN> after prog track operation

* <!> ESTOP <-> FORGET

* Auto current offset detection

* manage current offset and diagnostics

* neater msg at startup

* Add startup message to LCN master

* DCC::setJoinRelayPin

Co-authored-by: Asbelos <asbelos@btinternet.com>
This commit is contained in:
Fred
2021-03-23 10:37:05 -04:00
committed by GitHub
parent f556cc5e1c
commit d7b2cf3d76
17 changed files with 225 additions and 28 deletions

View File

@@ -30,6 +30,7 @@
#include "EEStore.h"
#include "DIAG.h"
#include <avr/wdt.h>
// 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
@@ -51,6 +52,9 @@ const int HASH_KEYWORD_LIMIT = 27413;
const int HASH_KEYWORD_ETHERNET = -30767;
const int HASH_KEYWORD_MAX = 16244;
const int HASH_KEYWORD_MIN = 15978;
const int HASH_KEYWORD_LCN = 15137;
const int HASH_KEYWORD_RESET = 26133;
int DCCEXParser::stashP[MAX_COMMAND_PARAMS];
bool DCCEXParser::stashBusy;
@@ -477,6 +481,10 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
}
return;
case '!': // ESTOP ALL <!>
DCC::setThrottle(0,1,1); // this broadcasts speed 1(estop) and sets all reminders to speed 1.
return;
case 'c': // SEND METER RESPONSES <c>
// <c MeterName value C/V unit min max res warn>
StringFormatter::send(stream, F("<c CurrentMAIN %d C Milli 0 %d 1 %d>"), DCCWaveform::mainTrack.getCurrentmA(),
@@ -520,6 +528,12 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream * ringStream)
StringFormatter::send(stream, F("<# %d>"), MAX_LOCOS);
return;
case '-': // Forget Loco <- [cab]>
if (params > 1 || p[0]<0) break;
if (p[0]==0) DCC::forgetAllLocos();
else DCC::forgetLoco(p[0]);
return;
case 'F': // New command to call the new Loco Function API <F cab func 1|0>
if (Diag::CMD)
DIAG(F("Setting loco %d F%d %S"), p[0], p[1], p[2] ? F("ON") : F("OFF"));
@@ -756,11 +770,22 @@ bool DCCEXParser::parseD(Print *stream, int params, int p[])
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;
case HASH_KEYWORD_PROGBOOST:
DCC::setProgTrackBoost(true);
return true;
return true;
case HASH_KEYWORD_RESET:
{
wdt_enable( WDTO_15MS); // set Arduino watchdog timer for 15ms
delay(50); // wait for the prescaller time to expire
break; // and <X> if we didnt restart
}
case HASH_KEYWORD_EEPROM: // <D EEPROM NumEntries>
if (params >= 2)
EEStore::dump(p[1]);