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

Parse strings with more than one command (<s><Q>) correct

This commit is contained in:
Harald Barth
2022-05-13 16:18:47 +02:00
parent 357560b226
commit ff73a60874
2 changed files with 16 additions and 1 deletions

View File

@@ -195,7 +195,21 @@ 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 DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) {
// This function can get stings of the form "<C OMM AND>" or "C OMM AND"
// found is true first after the leading "<" has been passed
bool found = (com[0] != '<');
for (byte *c=com; c[0] != '\0'; c++) {
if (found) {
parseOne(stream, c, ringStream);
found=false;
}
if (c[0] == '<')
found = true;
}
}
void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
{
#ifndef DISABLE_EEPROM
(void)EEPROM; // tell compiler not to warn this is unused