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

Compare commits

..

No commits in common. "bd02d1c15bf4cc35848d07b15c5630dcc352ebd8" and "1f5f7754c1a4b5c928fadf10046715cd4099aea5" have entirely different histories.

8 changed files with 19 additions and 73 deletions

View File

@ -86,7 +86,6 @@ const int16_t HASH_KEYWORD_C='C';
const int16_t HASH_KEYWORD_G='G'; const int16_t HASH_KEYWORD_G='G';
const int16_t HASH_KEYWORD_I='I'; const int16_t HASH_KEYWORD_I='I';
const int16_t HASH_KEYWORD_O='O'; const int16_t HASH_KEYWORD_O='O';
const int16_t HASH_KEYWORD_P='P';
const int16_t HASH_KEYWORD_R='R'; const int16_t HASH_KEYWORD_R='R';
const int16_t HASH_KEYWORD_T='T'; const int16_t HASH_KEYWORD_T='T';
const int16_t HASH_KEYWORD_X='X'; const int16_t HASH_KEYWORD_X='X';
@ -703,11 +702,10 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
if (tto->isHidden()) continue; if (tto->isHidden()) continue;
StringFormatter::send(stream, F(" %d"),tto->getId()); StringFormatter::send(stream, F(" %d"),tto->getId());
} }
StringFormatter::send(stream, F(">\n"));
} else { // <JO id> } else { // <JO id>
Turntable *tto=Turntable::get(id); Turntable *tto=Turntable::get(id);
if (!tto || tto->isHidden()) { if (!tto || tto->isHidden()) {
StringFormatter::send(stream, F(" %d X>\n"), id); StringFormatter::send(stream, F(" %d X"), id);
} else { } else {
uint8_t pos = tto->getPosition(); uint8_t pos = tto->getPosition();
uint8_t type = tto->isEXTT(); uint8_t type = tto->isEXTT();
@ -717,32 +715,15 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
todesc = RMFT2::getTurntableDescription(id); todesc = RMFT2::getTurntableDescription(id);
#endif #endif
if (todesc == NULL) todesc = F(""); if (todesc == NULL) todesc = F("");
StringFormatter::send(stream, F(" %d %d %d %d \"%S\">\n"), id, type, pos, posCount, todesc); StringFormatter::send(stream, F(" %d %d %d"), id, type, pos, todesc);
}
}
return;
case HASH_KEYWORD_P: // <JP id> returns turntable position list for the turntable id
if (params==2) { // <JP id>
Turntable *tto=Turntable::get(id);
if (!tto || tto->isHidden()) {
StringFormatter::send(stream, F(" %d X>\n"), id);
} else {
uint8_t posCount = tto->getPositionCount();
const FSH *tpdesc = NULL;
for (uint8_t p = 0; p < posCount; p++) { for (uint8_t p = 0; p < posCount; p++) {
StringFormatter::send(stream, F("<jP"));
int16_t value = tto->getPositionValue(p); int16_t value = tto->getPositionValue(p);
#ifdef EXRAIL_ACTIVE StringFormatter::send(stream, F(" %d"), value);
tpdesc = RMFT2::getTurntablePositionDescription(id, p);
#endif
if (tpdesc == NULL) tpdesc = F("");
StringFormatter::send(stream, F(" %d %d %d \"%S\""), id, p, value, tpdesc);
StringFormatter::send(stream, F(">\n"));
} }
} }
} else {
StringFormatter::send(stream, F("<jP X>\n"));
} }
StringFormatter::send(stream, F(">\n"));
return; return;
#endif #endif
default: break; default: break;

View File

@ -95,9 +95,7 @@ LookList * RMFT2::onAmberLookup=NULL;
LookList * RMFT2::onGreenLookup=NULL; LookList * RMFT2::onGreenLookup=NULL;
LookList * RMFT2::onChangeLookup=NULL; LookList * RMFT2::onChangeLookup=NULL;
LookList * RMFT2::onClockLookup=NULL; LookList * RMFT2::onClockLookup=NULL;
#ifndef IO_NO_HAL
LookList * RMFT2::onRotateLookup=NULL; LookList * RMFT2::onRotateLookup=NULL;
#endif
#define GET_OPCODE GETHIGHFLASH(RMFT2::RouteCode,progCounter) #define GET_OPCODE GETHIGHFLASH(RMFT2::RouteCode,progCounter)
#define SKIPOP progCounter+=3 #define SKIPOP progCounter+=3
@ -179,9 +177,8 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) {
onGreenLookup=LookListLoader(OPCODE_ONGREEN); onGreenLookup=LookListLoader(OPCODE_ONGREEN);
onChangeLookup=LookListLoader(OPCODE_ONCHANGE); onChangeLookup=LookListLoader(OPCODE_ONCHANGE);
onClockLookup=LookListLoader(OPCODE_ONTIME); onClockLookup=LookListLoader(OPCODE_ONTIME);
#ifndef IO_NO_HAL
onRotateLookup=LookListLoader(OPCODE_ONROTATE); onRotateLookup=LookListLoader(OPCODE_ONROTATE);
#endif
// Second pass startup, define any turnouts or servos, set signals red // Second pass startup, define any turnouts or servos, set signals red
// add sequences onRoutines to the lookups // add sequences onRoutines to the lookups
@ -1017,16 +1014,7 @@ void RMFT2::loop2() {
return; return;
} }
break; break;
#ifndef IO_NO_HAL
case OPCODE_WAITFORTT: // OPCODE_WAITFOR,V(turntable_id)
if (Turntable::ttMoving(operand)) {
delayMe(100);
return;
}
break;
#endif
case OPCODE_PRINT: case OPCODE_PRINT:
printMessage(operand); printMessage(operand);
break; break;
@ -1051,12 +1039,10 @@ void RMFT2::loop2() {
case OPCODE_ONGREEN: case OPCODE_ONGREEN:
case OPCODE_ONCHANGE: case OPCODE_ONCHANGE:
case OPCODE_ONTIME: case OPCODE_ONTIME:
#ifndef IO_NO_HAL
case OPCODE_DCCTURNTABLE: // Turntable definition ignored at runtime case OPCODE_DCCTURNTABLE: // Turntable definition ignored at runtime
case OPCODE_EXTTTURNTABLE: // Turntable definition ignored at runtime case OPCODE_EXTTTURNTABLE: // Turntable definition ignored at runtime
case OPCODE_TTADDPOSITION: // Turntable position definition ignored at runtime case OPCODE_TTADDPOSITION: // Turntable position definition ignored at runtime
case OPCODE_ONROTATE: case OPCODE_ONROTATE:
#endif
break; break;
@ -1201,12 +1187,10 @@ void RMFT2::changeEvent(int16_t vpin, bool change) {
if (change) handleEvent(F("CHANGE"),onChangeLookup,vpin); if (change) handleEvent(F("CHANGE"),onChangeLookup,vpin);
} }
#ifndef IO_NO_HAL
void RMFT2::rotateEvent(int16_t turntableId, bool change) { void RMFT2::rotateEvent(int16_t turntableId, bool change) {
// Hunt or an ONROTATE for this turntable // Hunt or an ONROTATE for this turntable
if (change) handleEvent(F("ROTATE"),onRotateLookup,turntableId); if (change) handleEvent(F("ROTATE"),onRotateLookup,turntableId);
} }
#endif
void RMFT2::clockEvent(int16_t clocktime, bool change) { void RMFT2::clockEvent(int16_t clocktime, bool change) {
// Hunt for an ONTIME for this time // Hunt for an ONTIME for this time

View File

@ -63,10 +63,8 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,
OPCODE_ONCHANGE, OPCODE_ONCHANGE,
OPCODE_ONCLOCKTIME, OPCODE_ONCLOCKTIME,
OPCODE_ONTIME, OPCODE_ONTIME,
#ifndef IO_NO_HAL
OPCODE_TTADDPOSITION,OPCODE_DCCTURNTABLE,OPCODE_EXTTTURNTABLE, OPCODE_TTADDPOSITION,OPCODE_DCCTURNTABLE,OPCODE_EXTTTURNTABLE,
OPCODE_ONROTATE,OPCODE_ROTATE,OPCODE_IFTTPOSITION,OPCODE_WAITFORTT, OPCODE_ONROTATE,OPCODE_ROTATE,OPCODE_IFTTPOSITION,
#endif
// OPcodes below this point are skip-nesting IF operations // OPcodes below this point are skip-nesting IF operations
// placed here so that they may be skipped as a group // placed here so that they may be skipped as a group
@ -199,9 +197,7 @@ private:
static LookList * onGreenLookup; static LookList * onGreenLookup;
static LookList * onChangeLookup; static LookList * onChangeLookup;
static LookList * onClockLookup; static LookList * onClockLookup;
#ifndef IO_NO_HAL
static LookList * onRotateLookup; static LookList * onRotateLookup;
#endif
// Local variables - exist for each instance/task // Local variables - exist for each instance/task
RMFT2 *next; // loop chain RMFT2 *next; // loop chain

View File

@ -150,9 +150,6 @@
#undef VIRTUAL_SIGNAL #undef VIRTUAL_SIGNAL
#undef VIRTUAL_TURNOUT #undef VIRTUAL_TURNOUT
#undef WAITFOR #undef WAITFOR
#ifndef IO_NO_HAL
#undef WAITFORTT
#endif
#undef WITHROTTLE #undef WITHROTTLE
#undef XFOFF #undef XFOFF
#undef XFON #undef XFON
@ -284,9 +281,6 @@
#define VIRTUAL_SIGNAL(id) #define VIRTUAL_SIGNAL(id)
#define VIRTUAL_TURNOUT(id,description...) #define VIRTUAL_TURNOUT(id,description...)
#define WAITFOR(pin) #define WAITFOR(pin)
#ifndef IO_NO_HAL
#define WAITFORTT(turntable_id)
#endif
#define WITHROTTLE(msg) #define WITHROTTLE(msg)
#define XFOFF(cab,func) #define XFOFF(cab,func)
#define XFON(cab,func) #define XFON(cab,func)

View File

@ -54,8 +54,6 @@
// helper macro for turnout descriptions, creates NULL for missing description // helper macro for turnout descriptions, creates NULL for missing description
#define O_DESC(id, desc) case id: return ("" desc)[0]?F("" desc):NULL; #define O_DESC(id, desc) case id: return ("" desc)[0]?F("" desc):NULL;
// helper macro for turntable descriptions, creates NULL for missing description
#define T_DESC(tid,pid,desc) if(turntableId==tid && positionId==pid) return ("" desc)[0]?F("" desc):NULL;
// helper macro for turnout description as HIDDEN // helper macro for turnout description as HIDDEN
#define HIDDEN "\x01" #define HIDDEN "\x01"
@ -205,14 +203,17 @@ const FSH * RMFT2::getTurntableDescription(int16_t turntableId) {
} }
// Pass to get turntable position descriptions (optional) // Pass to get turntable position descriptions (optional)
#include "EXRAIL2MacroReset.h" // #include "EXRAIL2MacroReset.h"
#undef TT_ADDPOSITION // #undef TT_ADDPOSITION
#define TT_ADDPOSITION(turntable_id,position,value,description...) T_DESC(turntable_id,position,description) // #define TT_ADDPOSITION(turntable_id,value,description...) O_DESC(turntable_id,description)
const FSH * RMFT2::getTurntablePositionDescription(int16_t turntableId, uint8_t positionId) { // const FSH * RMFT2::getTurntablePositionDescription(int16_t turntableId, uint8_t positionId) {
#include "myAutomation.h" // switch (turntableId) {
return NULL; // #include "myAutomation.h"
} // default:break;
// }
// return NULL;
// }
// Pass 6: Roster IDs (count) // Pass 6: Roster IDs (count)
#include "EXRAIL2MacroReset.h" #include "EXRAIL2MacroReset.h"
@ -419,9 +420,6 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
#define VIRTUAL_TURNOUT(id,description...) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(0), #define VIRTUAL_TURNOUT(id,description...) OPCODE_PINTURNOUT,V(id),OPCODE_PAD,V(0),
#define WITHROTTLE(msg) PRINT(msg) #define WITHROTTLE(msg) PRINT(msg)
#define WAITFOR(pin) OPCODE_WAITFOR,V(pin), #define WAITFOR(pin) OPCODE_WAITFOR,V(pin),
#ifndef IO_NO_HAL
#define WAITFORTT(turntable_id) OPCODE_WAITFORTT,V(turntable_id),
#endif
#define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func), #define XFOFF(cab,func) OPCODE_XFOFF,V(cab),OPCODE_PAD,V(func),
#define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func), #define XFON(cab,func) OPCODE_XFON,V(cab),OPCODE_PAD,V(func),

View File

@ -115,12 +115,6 @@ uint8_t Turntable::getPosition(uint16_t id) {
return tto->getPosition(); return tto->getPosition();
} }
bool Turntable::ttMoving(uint16_t id) {
Turntable *tto = get(id);
if (!tto) return false;
return tto->isMoving();
}
// Initiate a turntable move // Initiate a turntable move
bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) { bool Turntable::setPosition(uint16_t id, uint8_t position, uint8_t activity) {
#if defined(DIAG_IO) #if defined(DIAG_IO)

View File

@ -179,7 +179,6 @@ public:
inline static bool exists(uint16_t id) { return get(id) != 0; } inline static bool exists(uint16_t id) { return get(id) != 0; }
static bool setPosition(uint16_t id, uint8_t position, uint8_t activity=0); static bool setPosition(uint16_t id, uint8_t position, uint8_t activity=0);
static uint8_t getPosition(uint16_t id); static uint8_t getPosition(uint16_t id);
static bool ttMoving(uint16_t id);
inline static Turntable *first() { return _firstTurntable; } inline static Turntable *first() { return _firstTurntable; }
static bool printAll(Print *stream) { static bool printAll(Print *stream) {
bool gotOne = false; bool gotOne = false;

View File

@ -30,7 +30,7 @@ include_dir = .
[env] [env]
build_flags = -Wall -Wextra build_flags = -Wall -Wextra
; monitor_filters = time monitor_filters = time
; lib_deps = adafruit/Adafruit ST7735 and ST7789 Library @ ^1.10.0 ; lib_deps = adafruit/Adafruit ST7735 and ST7789 Library @ ^1.10.0
[env:samd21-dev-usb] [env:samd21-dev-usb]