1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-27 01:56:14 +01:00

Merge branch 'startupCommands' into ConsistR

This commit is contained in:
Asbelos 2021-01-21 11:00:01 +00:00
commit fa2b740bb4
3 changed files with 17 additions and 2 deletions

View File

@ -58,6 +58,12 @@ void setup()
RMFT::begin(); RMFT::begin();
#endif #endif
#if __has_include ( "mySetup.h")
#define SETUP(cmd) serialParser.parse(F(cmd))
#include "mySetup.h"
#undef SETUP
#endif
LCD(1,F("Ready")); LCD(1,F("Ready"));
} }

View File

@ -236,6 +236,14 @@ void DCCEXParser::setAtCommandCallback(AT_COMMAND_CALLBACK callback)
atCommandCallback = callback; atCommandCallback = callback;
} }
// Parse an F() string
void DCCEXParser::parse(const __FlashStringHelper * cmd) {
int size=strlen_P((char *)cmd)+1;
char buffer[size];
strcpy_P(buffer,(char *)cmd);
parse(&Serial,(byte *)buffer,true);
}
// 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, bool blocking) void DCCEXParser::parse(Print *stream, byte *com, bool blocking)
{ {

View File

@ -28,6 +28,7 @@ struct DCCEXParser
DCCEXParser(); DCCEXParser();
void loop(Stream & stream); void loop(Stream & stream);
void parse(Print * stream, byte * command, bool blocking); void parse(Print * stream, byte * command, bool blocking);
void parse(const __FlashStringHelper * cmd);
void flush(); void flush();
static void setFilter(FILTER_CALLBACK filter); static void setFilter(FILTER_CALLBACK filter);
static void setRMFTFilter(FILTER_CALLBACK filter); static void setRMFTFilter(FILTER_CALLBACK filter);