mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 08:06:13 +01:00
Remove Diags not needed
Tidy up Diags and responses - use HASH_KEYWORD in place of 'A'
This commit is contained in:
parent
25bbfa4c68
commit
52cfc18754
|
@ -157,6 +157,7 @@ const int16_t HASH_KEYWORD_VPIN=-415;
|
||||||
const int16_t HASH_KEYWORD_A='A';
|
const int16_t HASH_KEYWORD_A='A';
|
||||||
const int16_t HASH_KEYWORD_C='C';
|
const int16_t HASH_KEYWORD_C='C';
|
||||||
const int16_t HASH_KEYWORD_G='G';
|
const int16_t HASH_KEYWORD_G='G';
|
||||||
|
const int16_t HASH_KEYWORD_H='H';
|
||||||
const int16_t HASH_KEYWORD_I='I';
|
const int16_t HASH_KEYWORD_I='I';
|
||||||
const int16_t HASH_KEYWORD_O='O';
|
const int16_t HASH_KEYWORD_O='O';
|
||||||
const int16_t HASH_KEYWORD_P='P';
|
const int16_t HASH_KEYWORD_P='P';
|
||||||
|
@ -576,7 +577,8 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
prog=true;
|
prog=true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (p[0] >= 'A' && p[0] <= 'H') { // <1 A-H>
|
//else if (p[0] >= 'A' && p[0] <= 'H') { // <1 A-H>
|
||||||
|
else if (p[0] >= HASH_KEYWORD_A && p[0] <= HASH_KEYWORD_H) { // <1 A-H>
|
||||||
byte t = (p[0] - 'A');
|
byte t = (p[0] - 'A');
|
||||||
//DIAG(F("Processing track - %d "), t);
|
//DIAG(F("Processing track - %d "), t);
|
||||||
if (TrackManager::isProg(t)) {
|
if (TrackManager::isProg(t)) {
|
||||||
|
@ -591,10 +593,10 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
singletrack=true;
|
singletrack=true;
|
||||||
if (main) TrackManager::setTrackPower(false, false, POWERMODE::ON, t);
|
if (main) TrackManager::setTrackPower(false, false, POWERMODE::ON, t);
|
||||||
if (prog) TrackManager::setTrackPower(true, false, POWERMODE::ON, t);
|
if (prog) TrackManager::setTrackPower(true, false, POWERMODE::ON, t);
|
||||||
|
|
||||||
|
StringFormatter::send(stream, F("<1 %c>\n"), t+'A');
|
||||||
//CommandDistributor::broadcastPower();
|
//CommandDistributor::broadcastPower();
|
||||||
//TrackManager::streamTrackState(stream, t);
|
//TrackManager::streamTrackState(NULL,t);
|
||||||
TrackManager::streamTrackState(NULL,t);
|
|
||||||
StringFormatter::send(stream, F("Track %d ON\n"), t);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +637,8 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
prog=true;
|
prog=true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (p[0] >= 'A' && p[0] <= 'H') { // <1 A-H>
|
//else if (p[0] >= 'A' && p[0] <= 'H') { // <1 A-H>
|
||||||
|
else if (p[0] >= HASH_KEYWORD_A && p[0] <= HASH_KEYWORD_H) { // <1 A-H>
|
||||||
byte t = (p[0] - 'A');
|
byte t = (p[0] - 'A');
|
||||||
//DIAG(F("Processing track - %d "), t);
|
//DIAG(F("Processing track - %d "), t);
|
||||||
if (TrackManager::isProg(t)) {
|
if (TrackManager::isProg(t)) {
|
||||||
|
@ -652,11 +655,11 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
if (main) TrackManager::setTrackPower(false, false, POWERMODE::OFF, t);
|
if (main) TrackManager::setTrackPower(false, false, POWERMODE::OFF, t);
|
||||||
if (prog) {
|
if (prog) {
|
||||||
TrackManager::progTrackBoosted=false; // Prog track boost mode will not outlive prog track off
|
TrackManager::progTrackBoosted=false; // Prog track boost mode will not outlive prog track off
|
||||||
TrackManager::setTrackPower(true, false, POWERMODE::OFF, t);
|
TrackManager::setTrackPower(true, false, POWERMODE::OFF, t);
|
||||||
CommandDistributor::broadcastPower();
|
|
||||||
}
|
}
|
||||||
StringFormatter::send(stream, F("Track %d OFF\n"), t);
|
StringFormatter::send(stream, F("<0 %c>\n"), t+'A');
|
||||||
TrackManager::streamTrackState(NULL, t);
|
//CommandDistributor::broadcastPower();
|
||||||
|
//TrackManager::streamTrackState(NULL, t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ void TrackManager::streamTrackState(Print* stream, byte t) {
|
||||||
bool pstate = TrackManager::isPowerOn(t);
|
bool pstate = TrackManager::isPowerOn(t);
|
||||||
switch(track[t]->getMode()) {
|
switch(track[t]->getMode()) {
|
||||||
case TRACK_MODE_MAIN:
|
case TRACK_MODE_MAIN:
|
||||||
if (pstate) {format=F("<= %c MAIN ON \n");} else {format = F("<= %c MAIN OFF \n");}
|
if (pstate) {format=F("<= %c MAIN ON>\n");} else {format = F("<= %c MAIN OFF>\n");}
|
||||||
break;
|
break;
|
||||||
#ifndef DISABLE_PROG
|
#ifndef DISABLE_PROG
|
||||||
case TRACK_MODE_PROG:
|
case TRACK_MODE_PROG:
|
||||||
|
@ -445,12 +445,11 @@ void TrackManager::setTrackPower(bool setProg, bool setJoin, POWERMODE mode, byt
|
||||||
break;
|
break;
|
||||||
case TRACK_MODE_DC:
|
case TRACK_MODE_DC:
|
||||||
case TRACK_MODE_DCX:
|
case TRACK_MODE_DCX:
|
||||||
DIAG(F("Processing track - %d setProg %d"), thistrack, setProg);
|
//DIAG(F("Processing track - %d setProg %d"), thistrack, setProg);
|
||||||
if (setProg || setJoin) {DIAG(F("Nowt to do")); break;}
|
if (setProg || setJoin) break;
|
||||||
driver->setBrake(true); // DC starts with brake on
|
driver->setBrake(true); // DC starts with brake on
|
||||||
applyDCSpeed(thistrack); // speed match DCC throttles
|
applyDCSpeed(thistrack); // speed match DCC throttles
|
||||||
driver->setPower(mode);
|
driver->setPower(mode);
|
||||||
DIAG(F("Doing it anyway"));
|
|
||||||
break;
|
break;
|
||||||
case TRACK_MODE_PROG:
|
case TRACK_MODE_PROG:
|
||||||
if (!setProg && !setJoin) break;
|
if (!setProg && !setJoin) break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user