1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-04-24 05:51:20 +02:00

Fine tuning <L>

This commit is contained in:
Asbelos 2023-09-18 21:26:12 +01:00
parent 1225dabf49
commit a37174e064
2 changed files with 8 additions and 6 deletions

View File

@ -312,7 +312,7 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
for (int progCounter=0;; SKIPOP) { for (int progCounter=0;; SKIPOP) {
byte opcode=GET_OPCODE; byte opcode=GET_OPCODE;
if (opcode==OPCODE_ENDEXRAIL) break; if (opcode==OPCODE_ENDEXRAIL) break;
if (opcode==OPCODE_LCC) StringFormatter::send(stream,F("<LS x%h>"),getOperand(progCounter,0)); if (opcode==OPCODE_LCC) StringFormatter::send(stream,F("<LS x%h>\n"),getOperand(progCounter,0));
} }
// we stream the hex events we wish to listen to // we stream the hex events we wish to listen to
@ -324,13 +324,15 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
byte opcode=GET_OPCODE; byte opcode=GET_OPCODE;
if (opcode==OPCODE_ENDEXRAIL) break; if (opcode==OPCODE_ENDEXRAIL) break;
if (opcode==OPCODE_ONLCC) { if (opcode==OPCODE_ONLCC) {
onLCCLookup[eventIndex++]=progCounter; // TODO skip... onLCCLookup[eventIndex]=progCounter; // TODO skip...
StringFormatter::send(stream,F("<LL x%h%h%h:%h>"), StringFormatter::send(stream,F("<LL %d x%h%h%h:%h>\n"),
eventIndex,
getOperand(progCounter,1), getOperand(progCounter,1),
getOperand(progCounter,2), getOperand(progCounter,2),
getOperand(progCounter,3), getOperand(progCounter,3),
getOperand(progCounter,0) getOperand(progCounter,0)
); );
eventIndex++;
} }
} }
StringFormatter::send(stream,F("<LR>\n")); // Ready to rumble StringFormatter::send(stream,F("<LR>\n")); // Ready to rumble
@ -350,7 +352,7 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
} }
if (reject) { if (reject) {
opcode=0; opcode=0;
StringFormatter::send(stream,F("<X>")); StringFormatter::send(stream,F("<X>\n"));
} }
} }

View File

@ -219,12 +219,12 @@ void StringFormatter::printPadded(Print* stream, long value, byte width, bool fo
if (!formatLeft) stream->print(value, DEC); if (!formatLeft) stream->print(value, DEC);
} }
const char FLASH Hexpattern[]="0123456789ABCDEF";
// printHex prints the full 2 byte hex with leading zeros, unlike print(value,HEX) // printHex prints the full 2 byte hex with leading zeros, unlike print(value,HEX)
const char FLASH hexchars[]="0123456789ABCDEF";
void StringFormatter::printHex(Print * stream,uint16_t value) { void StringFormatter::printHex(Print * stream,uint16_t value) {
char result[5]; char result[5];
for (int i=3;i>=0;i--) { for (int i=3;i>=0;i--) {
result[i]=GETFLASH(Hexpattern+(value & 0xFF)); result[i]=GETFLASH(hexchars+(value & 0x0F));
value>>=4; value>>=4;
} }
result[4]='\0'; result[4]='\0';