diff --git a/DCCEXParser.cpp b/DCCEXParser.cpp index b434428..f1bef16 100644 --- a/DCCEXParser.cpp +++ b/DCCEXParser.cpp @@ -189,7 +189,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 "" 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 diff --git a/DCCEXParser.h b/DCCEXParser.h index d9fe0e1..797eab0 100644 --- a/DCCEXParser.h +++ b/DCCEXParser.h @@ -33,6 +33,7 @@ struct DCCEXParser static void parse(Print * stream, byte * command, RingStream * ringStream); static void parse(const FSH * cmd); + static void parseOne(Print * stream, byte * command, RingStream * ringStream); static void setFilter(FILTER_CALLBACK filter); static void setRMFTFilter(FILTER_CALLBACK filter); static void setAtCommandCallback(AT_COMMAND_CALLBACK filter); diff --git a/EXRAIL2.cpp b/EXRAIL2.cpp index 65df9e3..243768b 100644 --- a/EXRAIL2.cpp +++ b/EXRAIL2.cpp @@ -172,7 +172,7 @@ int16_t LookList::find(int16_t value) { for (int sigpos=0;;sigpos+=4) { VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigpos); if (sigid==0) break; // end of signal list - doSignal(sigid & (~ SERVO_SIGNAL_FLAG) & (~ACTIVE_HIGH_SIGNAL_FLAG), SIGNAL_RED); + doSignal(sigid & SIGNAL_ID_MASK, SIGNAL_RED); } for (progCounter=0;; SKIPOP){ @@ -320,12 +320,23 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) { // Now stream the flags for (int id=0;id\n")); return true; } @@ -996,7 +1007,7 @@ int16_t RMFT2::getSignalSlot(VPIN id) { // for a LED signal it will be same as redpin // but for a servo signal it will also have SERVO_SIGNAL_FLAG set. - if ((sigid & ~SERVO_SIGNAL_FLAG & ~ACTIVE_HIGH_SIGNAL_FLAG)!= id) continue; // keep looking + if ((sigid & SIGNAL_ID_MASK)!= id) continue; // keep looking return sigpos/4; // relative slot in signals table } } diff --git a/EXRAIL2.h b/EXRAIL2.h index b779a6a..ba7facd 100644 --- a/EXRAIL2.h +++ b/EXRAIL2.h @@ -108,6 +108,7 @@ class LookList { static void activateEvent(int16_t addr, bool active); static const int16_t SERVO_SIGNAL_FLAG=0x4000; static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000; + static const int16_t SIGNAL_ID_MASK=0x0FFF; // Throttle Info Access functions built by exrail macros static const byte rosterNameCount; diff --git a/Turnouts.h b/Turnouts.h index 3d1f0bc..b181709 100644 --- a/Turnouts.h +++ b/Turnouts.h @@ -60,9 +60,9 @@ protected: union { struct { bool closed : 1; - bool _rfu: 2; - bool hidden: 1; - uint8_t turnoutType : 4; + bool hidden : 1; + bool _rfu : 1; + uint8_t turnoutType : 5; }; uint8_t flags; }; diff --git a/version.h b/version.h index 2dcb496..e3ff37a 100644 --- a/version.h +++ b/version.h @@ -11,6 +11,11 @@ // TrackManager DCC & DC up to 8 Districts Architecture // Automatic ALIAS(name) // Command Parser now accepts Underscore in Alias Names +// 4.1.1 Bugfix: preserve turnout format +// Bugfix: parse multiple commands in one buffer string correct +// Bugfix: command signal status in Exrail +// 4.1.0 ... +// // 4.0.2 EXRAIL additions: // ACK defaults set to 50mA LIMIT, 2000uS MIN, 20000uS MAX // myFilter automatic detection (no need to call setFilter)