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

Improved display and loop time for signals.

This commit is contained in:
Asbelos 2022-05-19 09:03:28 +01:00
parent 506b65d0ea
commit ebebd0dc11
2 changed files with 12 additions and 10 deletions

View File

@ -172,7 +172,7 @@ int16_t LookList::find(int16_t value) {
for (int sigpos=0;;sigpos+=4) { for (int sigpos=0;;sigpos+=4) {
VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigpos); VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigpos);
if (sigid==0) break; // end of signal list 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){ for (progCounter=0;; SKIPOP){
@ -327,14 +327,15 @@ bool RMFT2::parseSlash(Print * stream, byte & paramCount, int16_t p[]) {
} }
} }
// do the signals // do the signals
// flags[n] represents the state of the nth signal in the table // flags[n] represents the state of the nth signal in the table
for (int id=0;id<MAX_FLAGS; id++) { for (int sigslot=0;;sigslot++) {
byte flag=flags[id] & SIGNAL_MASK; VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+sigslot*4);
if (flag==0) break; // no more will be found if (sigid==0) break; // end of signal list
VPIN sigid=GETFLASHW(RMFT2::SignalDefinitions+4*id) & (~ SERVO_SIGNAL_FLAG) & (~ACTIVE_HIGH_SIGNAL_FLAG); byte flag=flags[sigslot] & SIGNAL_MASK; // obtain signal flags for this id
StringFormatter::send(stream,F("\nSignal[%d] %S"), sigid, StringFormatter::send(stream,F("\n%S[%d]"),
(flag == SIGNAL_RED)? F("RED") : (flag==SIGNAL_GREEN) ? F("GREEN") : F("AMBER")); (flag == SIGNAL_RED)? F("RED") : (flag==SIGNAL_GREEN) ? F("GREEN") : F("AMBER"),
} sigid & SIGNAL_ID_MASK);
}
StringFormatter::send(stream,F(" *>\n")); StringFormatter::send(stream,F(" *>\n"));
return true; return true;
@ -994,7 +995,7 @@ int16_t RMFT2::getSignalSlot(VPIN id) {
// for a LED signal it will be same as redpin // for a LED signal it will be same as redpin
// but for a servo signal it will also have SERVO_SIGNAL_FLAG set. // 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 return sigpos/4; // relative slot in signals table
} }
} }

View File

@ -107,6 +107,7 @@ class LookList {
static void activateEvent(int16_t addr, bool active); static void activateEvent(int16_t addr, bool active);
static const int16_t SERVO_SIGNAL_FLAG=0x4000; static const int16_t SERVO_SIGNAL_FLAG=0x4000;
static const int16_t ACTIVE_HIGH_SIGNAL_FLAG=0x2000; 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 // Throttle Info Access functions built by exrail macros
static const byte rosterNameCount; static const byte rosterNameCount;