mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
Compare commits
1 Commits
8e755fd672
...
f92b4d3a79
Author | SHA1 | Date | |
---|---|---|---|
|
f92b4d3a79 |
|
@ -210,10 +210,8 @@ int16_t DCCEXParser::splitValues(int16_t result[MAX_COMMAND_PARAMS], const byte
|
||||||
case 1: // skipping spaces before a param
|
case 1: // skipping spaces before a param
|
||||||
if (hot == ' ')
|
if (hot == ' ')
|
||||||
break;
|
break;
|
||||||
if (hot == '\0')
|
if (hot == '\0' || hot == '>')
|
||||||
return -1;
|
return parameterCount;
|
||||||
if (hot == '>')
|
|
||||||
return parameterCount;
|
|
||||||
state = 2;
|
state = 2;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -306,18 +304,13 @@ 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
|
||||||
#endif
|
#endif
|
||||||
byte params = 0;
|
|
||||||
if (Diag::CMD)
|
if (Diag::CMD)
|
||||||
DIAG(F("PARSING:%s"), com);
|
DIAG(F("PARSING:%s"), com);
|
||||||
int16_t p[MAX_COMMAND_PARAMS];
|
int16_t p[MAX_COMMAND_PARAMS];
|
||||||
while (com[0] == '<' || com[0] == ' ')
|
while (com[0] == '<' || com[0] == ' ')
|
||||||
com++; // strip off any number of < or spaces
|
com++; // strip off any number of < or spaces
|
||||||
byte opcode = com[0];
|
byte opcode = com[0];
|
||||||
int16_t splitnum = splitValues(p, com, opcode=='M' || opcode=='P');
|
byte params = splitValues(p, com, opcode=='M' || opcode=='P');
|
||||||
if (splitnum < 0 || splitnum >= MAX_COMMAND_PARAMS) // if arguments are broken, leave but via printing <X>
|
|
||||||
goto out;
|
|
||||||
// Because of check above we are now inside byte size
|
|
||||||
params = splitnum;
|
|
||||||
|
|
||||||
if (filterCallback)
|
if (filterCallback)
|
||||||
filterCallback(stream, opcode, params, p);
|
filterCallback(stream, opcode, params, p);
|
||||||
|
@ -844,18 +837,14 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default: //anything else will diagnose and drop out to <X>
|
default: //anything else will diagnose and drop out to <X>
|
||||||
if (opcode >= ' ' && opcode <= '~') {
|
|
||||||
DIAG(F("Opcode=%c params=%d"), opcode, params);
|
DIAG(F("Opcode=%c params=%d"), opcode, params);
|
||||||
for (int i = 0; i < params; i++)
|
for (int i = 0; i < params; i++)
|
||||||
DIAG(F("p[%d]=%d (0x%x)"), i, p[i], p[i]);
|
DIAG(F("p[%d]=%d (0x%x)"), i, p[i], p[i]);
|
||||||
} else {
|
break;
|
||||||
DIAG(F("Unprintable %x"), opcode);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
} // end of opcode switch
|
} // end of opcode switch
|
||||||
|
|
||||||
out:// Any fallout here sends an <X>
|
// Any fallout here sends an <X>
|
||||||
StringFormatter::send(stream, F("<X>\n"));
|
StringFormatter::send(stream, F("<X>\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-202311160737Z"
|
#define GITHUB_SHA "devel-202311141013Z"
|
||||||
|
|
|
@ -111,15 +111,14 @@ void SerialManager::loop2() {
|
||||||
bufferLength = 0;
|
bufferLength = 0;
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
}
|
}
|
||||||
else if (inCommandPayload) {
|
else if (ch == '>') {
|
||||||
if (bufferLength < (COMMAND_BUFFER_SIZE-1))
|
buffer[bufferLength] = '\0';
|
||||||
buffer[bufferLength++] = ch;
|
DCCEXParser::parse(serial, buffer, NULL);
|
||||||
if (ch == '>') {
|
inCommandPayload = false;
|
||||||
buffer[bufferLength] = '\0';
|
break;
|
||||||
DCCEXParser::parse(serial, buffer, NULL);
|
}
|
||||||
inCommandPayload = false;
|
else if (inCommandPayload) {
|
||||||
break;
|
if (bufferLength < (COMMAND_BUFFER_SIZE-1)) buffer[bufferLength++] = ch;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.3"
|
#define VERSION "5.2.2"
|
||||||
// 5.2.3 - Bugfix: Catch stange input to parser
|
|
||||||
// 5.2.2 - Added option to allow MAX_CHARACTER_ROWS to be defined in config.h
|
// 5.2.2 - Added option to allow MAX_CHARACTER_ROWS to be defined in config.h
|
||||||
// 5.2.1 - Trackmanager rework for simpler structure
|
// 5.2.1 - Trackmanager rework for simpler structure
|
||||||
// 5.2.0 - ESP32: Autoreverse and booster mode support
|
// 5.2.0 - ESP32: Autoreverse and booster mode support
|
||||||
|
|
Loading…
Reference in New Issue
Block a user