mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 08:06:13 +01:00
Parse strings with more than one command (<s><Q>) correct
This commit is contained in:
parent
357560b226
commit
ff73a60874
|
@ -195,7 +195,21 @@ void DCCEXParser::parse(const FSH * cmd) {
|
||||||
|
|
||||||
// See documentation on DCC class for info on this section
|
// 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
|
#ifndef DISABLE_EEPROM
|
||||||
(void)EEPROM; // tell compiler not to warn this is unused
|
(void)EEPROM; // tell compiler not to warn this is unused
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct DCCEXParser
|
||||||
|
|
||||||
static void parse(Print * stream, byte * command, RingStream * ringStream);
|
static void parse(Print * stream, byte * command, RingStream * ringStream);
|
||||||
static void parse(const FSH * cmd);
|
static void parse(const FSH * cmd);
|
||||||
|
static void parseOne(Print * stream, byte * command, RingStream * ringStream);
|
||||||
static void setFilter(FILTER_CALLBACK filter);
|
static void setFilter(FILTER_CALLBACK filter);
|
||||||
static void setRMFTFilter(FILTER_CALLBACK filter);
|
static void setRMFTFilter(FILTER_CALLBACK filter);
|
||||||
static void setAtCommandCallback(AT_COMMAND_CALLBACK filter);
|
static void setAtCommandCallback(AT_COMMAND_CALLBACK filter);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user