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

Compare commits

...

8 Commits

Author SHA1 Message Date
Kcsmith0708
a9a40c807a
Merge 5d411e6a08 into b4e7982099 2024-04-25 07:36:22 -04:00
Harald Barth
b4e7982099 remove forgotten #define DIAG_IO 2024-04-22 08:12:08 +02:00
Harald Barth
3af2f67792 version 5.2.51 2024-04-21 19:41:30 +02:00
Harald Barth
c382bd33bc Distinguish between sighandle and sigid 2024-04-21 19:03:24 +02:00
Kcsmith0708
5d411e6a08
Update DCCEXParser.cpp
edited out extra paren )
2024-04-12 16:28:11 -04:00
Kcsmith0708
7bd1bae470
Update DCCEXParser.cpp 2024-04-12 13:18:47 -04:00
Kcsmith0708
7cc3cf9c65
Update DCCEXParser.cpp
Added setVirtualLCDSerial(Null);
to stop the <@ responses from streaming through the serial monitor
2024-04-12 13:16:44 -04:00
Kcsmith0708
2738d86431
Update DCCEXParser.cpp
Virtual LCD#0  line 8 "Powered by DCC-EX"
2024-04-10 13:39:53 -04:00
6 changed files with 33 additions and 26 deletions

View File

@ -809,7 +809,9 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
CommandDistributor::setVirtualLCDSerial(stream); CommandDistributor::setVirtualLCDSerial(stream);
StringFormatter::send(stream, StringFormatter::send(stream,
F("<@ 0 0 \"DCC-EX v" VERSION "\">\n" F("<@ 0 0 \"DCC-EX v" VERSION "\">\n"
"<@ 0 1 \"Lic GPLv3\">\n")); "<@ 0 1 \"Lic GPLv3 \">\n"
"<@ 0 8 \"Powered by DCC-EX \">\n"
CommandDistributor::setVirtualLCDSerial(NULL);
return; return;
#endif #endif
default: //anything else will diagnose and drop out to <X> default: //anything else will diagnose and drop out to <X>

View File

@ -210,9 +210,10 @@ if (compileFeatures & FEATURE_SIGNAL) {
onAmberLookup=LookListLoader(OPCODE_ONAMBER); onAmberLookup=LookListLoader(OPCODE_ONAMBER);
onGreenLookup=LookListLoader(OPCODE_ONGREEN); onGreenLookup=LookListLoader(OPCODE_ONGREEN);
for (int sigslot=0;;sigslot++) { for (int sigslot=0;;sigslot++) {
VPIN sigid=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8); int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8);
if (sigid==0) break; // end of signal list if (sighandle==0) break; // end of signal list
doSignal(sigid & SIGNAL_ID_MASK, SIGNAL_RED); VPIN sigid = sighandle & SIGNAL_ID_MASK;
doSignal(sigid, SIGNAL_RED);
} }
} }
@ -1143,16 +1144,17 @@ void RMFT2::kill(const FSH * reason, int operand) {
int16_t RMFT2::getSignalSlot(int16_t id) { int16_t RMFT2::getSignalSlot(int16_t id) {
for (int sigslot=0;;sigslot++) { for (int sigslot=0;;sigslot++) {
int16_t sigid=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8); int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8);
if (sigid==0) { // end of signal list if (sighandle==0) { // end of signal list
DIAG(F("EXRAIL Signal %d not defined"), id); DIAG(F("EXRAIL Signal %d not defined"), id);
return -1; return -1;
} }
VPIN sigid = sighandle & SIGNAL_ID_MASK;
// sigid is the signal id used in RED/AMBER/GREEN macro // sigid is the signal id used in RED/AMBER/GREEN macro
// 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 & SIGNAL_ID_MASK)!= id) continue; // keep looking if (sigid != id) continue; // keep looking
return sigslot; // relative slot in signals table return sigslot; // relative slot in signals table
} }
} }
@ -1175,13 +1177,14 @@ int16_t RMFT2::getSignalSlot(int16_t id) {
// Correct signal definition found, get the rag values // Correct signal definition found, get the rag values
int16_t sigpos=sigslot*8; int16_t sigpos=sigslot*8;
VPIN sigid=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos); int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos);
VPIN redpin=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+2); VPIN redpin=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+2);
VPIN amberpin=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+4); VPIN amberpin=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+4);
VPIN greenpin=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+6); VPIN greenpin=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+6);
//if (diag) DIAG(F("signal %d %d %d %d %d"),sigid,id,redpin,amberpin,greenpin); //if (diag) DIAG(F("signal %d %d %d %d %d"),sigid,id,redpin,amberpin,greenpin);
VPIN sigtype=sigid & ~SIGNAL_ID_MASK; VPIN sigtype=sighandle & ~SIGNAL_ID_MASK;
VPIN sigid = sighandle & SIGNAL_ID_MASK;
if (sigtype == SERVO_SIGNAL_FLAG) { if (sigtype == SERVO_SIGNAL_FLAG) {
// A servo signal, the pin numbers are actually servo positions // A servo signal, the pin numbers are actually servo positions
@ -1204,7 +1207,7 @@ int16_t RMFT2::getSignalSlot(int16_t id) {
byte value=redpin; byte value=redpin;
if (rag==SIGNAL_AMBER) value=amberpin; if (rag==SIGNAL_AMBER) value=amberpin;
if (rag==SIGNAL_GREEN) value=greenpin; if (rag==SIGNAL_GREEN) value=greenpin;
DCC::setExtendedAccessory(sigid & SIGNAL_ID_MASK,value); DCC::setExtendedAccessory(sigid, value);
return; return;
} }
@ -1255,8 +1258,9 @@ bool RMFT2::signalAspectEvent(int16_t address, byte aspect ) {
int16_t sigslot=getSignalSlot(address); int16_t sigslot=getSignalSlot(address);
if (sigslot<0) return false; // this is not a defined signal if (sigslot<0) return false; // this is not a defined signal
int16_t sigpos=sigslot*8; int16_t sigpos=sigslot*8;
VPIN sigid=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos); int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos);
VPIN sigtype=sigid & ~SIGNAL_ID_MASK; VPIN sigtype=sighandle & ~SIGNAL_ID_MASK;
VPIN sigid = sighandle & SIGNAL_ID_MASK;
if (sigtype!=DCCX_SIGNAL_FLAG) return false; // not a DCCX signal if (sigtype!=DCCX_SIGNAL_FLAG) return false; // not a DCCX signal
// Turn an aspect change into a RED/AMBER/GREEN setting // Turn an aspect change into a RED/AMBER/GREEN setting
if (aspect==GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+2)) { if (aspect==GETHIGHFLASHW(RMFT2::SignalDefinitions,sigpos+2)) {

View File

@ -214,12 +214,13 @@ 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 sigslot=0;;sigslot++) { for (int sigslot=0;;sigslot++) {
VPIN sigid=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8); int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8);
if (sigid==0) break; // end of signal list if (sighandle==0) break; // end of signal list
VPIN sigid = sighandle & SIGNAL_ID_MASK;
byte flag=flags[sigslot] & SIGNAL_MASK; // obtain signal flags for this id byte flag=flags[sigslot] & SIGNAL_MASK; // obtain signal flags for this id
StringFormatter::send(stream,F("\n%S[%d]"), 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); sigid);
} }
} }

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202404061747Z" #define GITHUB_SHA "devel-202404211704Z"

View File

@ -123,7 +123,6 @@
return true; return true;
} }
#define DIAG_IO
// Static setClosed function is invoked from close(), throw() etc. to perform the // Static setClosed function is invoked from close(), throw() etc. to perform the
// common parts of the turnout operation. Code which is specific to a turnout // common parts of the turnout operation. Code which is specific to a turnout
// type should be placed in the virtual function setClosedInternal(bool) which is // type should be placed in the virtual function setClosedInternal(bool) which is

View File

@ -3,7 +3,8 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.50" #define VERSION "5.2.51"
// 5.2.51 - Bugfix for SIGNAL: Distinguish between sighandle and sigid
// 5.2.50 - EXRAIL ONBUTTON/ONSENSOR observe LATCH // 5.2.50 - EXRAIL ONBUTTON/ONSENSOR observe LATCH
// 5.2.49 - EXRAIL additions: // 5.2.49 - EXRAIL additions:
// ONBUTTON, ONSENSOR // ONBUTTON, ONSENSOR