Skip to content

Commit

Permalink
Fix non-routestate code eliminator
Browse files Browse the repository at this point in the history
  • Loading branch information
Asbelos committed Nov 10, 2023
1 parent 6c18226 commit d877fc3
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions EXRAIL2Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16

case 'J': // throttle info commands
// This entire code block is compiled out if FEATURE_ROUTESTATE macros not used
if (paramCount<1 || !(compileFeatures & FEATURE_ROUTESTATE)) return;
if (paramCount<1) return;
switch(p[0])
case HASH_KEYWORD_A: // <JA> returns automations/routes
if (paramCount==1) {// <JA>
Expand All @@ -136,14 +136,16 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
uint16_t id=p[1];
StringFormatter::send(stream,F("<jA %d %c \"%S\">\n"),
id, getRouteType(id), getRouteDescription(id));

// Send any non-default button states or captions
int16_t statePos=routeLookup->findPosition(id);
if (statePos>=0) {
if (routeStateArray[statePos])
StringFormatter::send(stream,F("<jB %d %d>\n"), id, routeStateArray[statePos]);
if (routeCaptionArray[statePos])
StringFormatter::send(stream,F("<jB %d \"%S\">\n"), id,routeCaptionArray[statePos]);

if (compileFeatures & FEATURE_ROUTESTATE) {
// Send any non-default button states or captions
int16_t statePos=routeLookup->findPosition(id);
if (statePos>=0) {
if (routeStateArray[statePos])
StringFormatter::send(stream,F("<jB %d %d>\n"), id, routeStateArray[statePos]);
if (routeCaptionArray[statePos])
StringFormatter::send(stream,F("<jB %d \"%S\">\n"), id,routeCaptionArray[statePos]);
}
}
opcode=0;
return;
Expand Down

0 comments on commit d877fc3

Please sign in to comment.