mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Compile time optimization for booster mode
This commit is contained in:
parent
274affce45
commit
7503421eb6
|
@ -34,9 +34,15 @@ template<class T> inline T operator| (T a, T b) { return (T)((int)a | (int)b); }
|
||||||
template<class T> inline T operator& (T a, T b) { return (T)((int)a & (int)b); }
|
template<class T> inline T operator& (T a, T b) { return (T)((int)a & (int)b); }
|
||||||
template<class T> inline T operator^ (T a, T b) { return (T)((int)a ^ (int)b); }
|
template<class T> inline T operator^ (T a, T b) { return (T)((int)a ^ (int)b); }
|
||||||
enum TRACK_MODE : byte {TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PROG = 4,
|
enum TRACK_MODE : byte {TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PROG = 4,
|
||||||
TRACK_MODE_DC = 8, TRACK_MODE_EXT = 16, TRACK_MODE_BOOST = 32,
|
TRACK_MODE_DC = 8, TRACK_MODE_EXT = 16,
|
||||||
TRACK_MODE_ALL = 62, // only to operate all tracks
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
TRACK_MODE_INV = 64, TRACK_MODE_DCX = 72 /*DC + INV*/, TRACK_MODE_AUTOINV = 128};
|
TRACK_MODE_BOOST = 32,
|
||||||
|
#else
|
||||||
|
TRACK_MODE_BOOST = 0,
|
||||||
|
#endif
|
||||||
|
TRACK_MODE_ALL = TRACK_MODE_MAIN|TRACK_MODE_PROG|TRACK_MODE_DC|TRACK_MODE_EXT|TRACK_MODE_BOOST,
|
||||||
|
TRACK_MODE_INV = 64,
|
||||||
|
TRACK_MODE_DCX = TRACK_MODE_DC|TRACK_MODE_INV, TRACK_MODE_AUTOINV = 128};
|
||||||
|
|
||||||
#define setHIGH(fastpin) *fastpin.inout |= fastpin.maskHIGH
|
#define setHIGH(fastpin) *fastpin.inout |= fastpin.maskHIGH
|
||||||
#define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW
|
#define setLOW(fastpin) *fastpin.inout &= fastpin.maskLOW
|
||||||
|
|
|
@ -362,7 +362,8 @@ bool TrackManager::parseEqualSign(Print *stream, int16_t params, int16_t p[])
|
||||||
if (params==2 && p[1]=="EXT"_hk) // <= id EXT>
|
if (params==2 && p[1]=="EXT"_hk) // <= id EXT>
|
||||||
return setTrackMode(p[0],TRACK_MODE_EXT);
|
return setTrackMode(p[0],TRACK_MODE_EXT);
|
||||||
#ifdef BOOSTER_INPUT
|
#ifdef BOOSTER_INPUT
|
||||||
if (params==2 && p[1]=="BOOST"_hk) // <= id BOOST>
|
if (TRACK_MODE_BOOST != 0 && // compile time optimization
|
||||||
|
params==2 && p[1]=="BOOST"_hk) // <= id BOOST>
|
||||||
return setTrackMode(p[0],TRACK_MODE_BOOST);
|
return setTrackMode(p[0],TRACK_MODE_BOOST);
|
||||||
#endif
|
#endif
|
||||||
if (params==2 && p[1]=="AUTO"_hk) // <= id AUTO>
|
if (params==2 && p[1]=="AUTO"_hk) // <= id AUTO>
|
||||||
|
@ -401,11 +402,11 @@ const FSH* TrackManager::getModeName(TRACK_MODE tm) {
|
||||||
modename=F("EXT");
|
modename=F("EXT");
|
||||||
else if(tm & TRACK_MODE_BOOST) {
|
else if(tm & TRACK_MODE_BOOST) {
|
||||||
if(tm & TRACK_MODE_AUTOINV)
|
if(tm & TRACK_MODE_AUTOINV)
|
||||||
modename=F("B A");
|
modename=F("BOOST A");
|
||||||
else if (tm & TRACK_MODE_INV)
|
else if (tm & TRACK_MODE_INV)
|
||||||
modename=F("B I");
|
modename=F("BOOST I");
|
||||||
else
|
else
|
||||||
modename=F("B");
|
modename=F("BOOST");
|
||||||
}
|
}
|
||||||
else if (tm & TRACK_MODE_DC) {
|
else if (tm & TRACK_MODE_DC) {
|
||||||
if (tm & TRACK_MODE_INV)
|
if (tm & TRACK_MODE_INV)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user