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

Compare commits

...

17 Commits

Author SHA1 Message Date
Kcsmith0708
96ba06b473
Merge 5d411e6a08 into 2172d2e175 2024-05-19 23:44:41 -05:00
Harald Barth
2172d2e175 make WDT time longer to work around bootloader bug 2024-05-11 08:46:25 +02:00
Harald Barth
86291cbec4 signal id of 0 does not work 2024-05-11 07:45:28 +02:00
Harald Barth
66791b19f5 remove stupid comment 2024-05-11 07:43:24 +02:00
Harald Barth
6689a1d35f version 5.2.57 2024-05-09 17:11:09 +02:00
Harald Barth
91818ed80c apply mode by binart bit match and not by equality 2024-05-09 17:06:33 +02:00
Harald Barth
86310aea4f getSignalSlot minor typo (and indent/comments) fix 2024-05-09 15:18:00 +02:00
pmantoine
a610e83f6e Bugfix and refactor for EXRAIL getSignalSlot 2024-05-07 18:20:37 +08:00
pmantoine
1449dc7bac EXRAIL move isSignal to public for STEALTH 2024-05-07 15:12:37 +08:00
pmantoine
bd11cfbf8b Bugfix EXRAIL active high signal handling 2024-05-07 11:29:49 +08:00
pmantoine
16214fad66 EX-Fastclock bugfix for address check 2024-05-07 11:13:19 +08:00
pmantoine
76ad3ee48d STM32 bug fixes, port usage 2024-05-07 11:10:39 +08:00
Asbelos
742b100f65 Comments only 2024-05-02 09:48:18 +01: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
8 changed files with 44 additions and 26 deletions

View File

@ -70,8 +70,8 @@ Once a new OPCODE is decided upon, update this list.
L, Reserved for LCC interface (implemented in EXRAIL) L, Reserved for LCC interface (implemented in EXRAIL)
m, message to throttles broadcast m, message to throttles broadcast
M, Write DCC packet M, Write DCC packet
n, n, Reserved for SensorCam
N, N, Reserved for Sensorcam
o, o,
O, Output broadcast O, Output broadcast
p, Broadcast power state p, Broadcast power state
@ -91,10 +91,10 @@ Once a new OPCODE is decided upon, update this list.
w, Write CV on main w, Write CV on main
W, Write CV W, Write CV
x, x,
X, Invalid command X, Invalid command response
y, y,
Y, Output broadcast Y, Output broadcast
z, z, Direct output
Z, Output configuration/control Z, Output configuration/control
*/ */
@ -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

@ -185,8 +185,10 @@ int DCCTimer::freeMemory() {
} }
void DCCTimer::reset() { void DCCTimer::reset() {
wdt_enable( WDTO_15MS); // set Arduino watchdog timer for 15ms // 250ms chosen to circumwent bootloader bug which
delay(50); // wait for the prescaller time to expire // hangs at too short timepout (like 15ms)
wdt_enable( WDTO_250MS); // set Arduino watchdog timer for 250ms
delay(500); // wait for it to happen
} }

View File

@ -1,4 +1,5 @@
/* /*
* © 2024 Paul M. Antoine
* © 2021 Neil McKechnie * © 2021 Neil McKechnie
* © 2021-2023 Harald Barth * © 2021-2023 Harald Barth
* © 2020-2023 Chris Harlow * © 2020-2023 Chris Harlow
@ -1143,20 +1144,25 @@ 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++) {
int16_t sighandle=GETHIGHFLASHW(RMFT2::SignalDefinitions,sigslot*8); if (id > 0) {
if (sighandle==0) { // end of signal list int sigslot = 0;
DIAG(F("EXRAIL Signal %d not defined"), id); int16_t sighandle = 0;
return -1; // Trundle down the signal list until we reach the end
} while ((sighandle = GETHIGHFLASHW(RMFT2::SignalDefinitions, sigslot * 8)) != 0)
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.
VPIN sigid = sighandle & SIGNAL_ID_MASK;
if (sigid != id) continue; // keep looking if (sigid == (VPIN)id) // cast to keep compiler happy but id is positive
return sigslot; // relative slot in signals table return sigslot; // found it
sigslot++; // keep looking
};
} }
// If we got here, we did not find the signal
DIAG(F("EXRAIL Signal %d not defined"), id);
return -1;
} }
/* static */ void RMFT2::doSignal(int16_t id,char rag) { /* static */ void RMFT2::doSignal(int16_t id,char rag) {
@ -1218,7 +1224,7 @@ int16_t RMFT2::getSignalSlot(int16_t id) {
if (rag==SIGNAL_AMBER && (amberpin==0)) rag=SIMAMBER; // special case this func only if (rag==SIGNAL_AMBER && (amberpin==0)) rag=SIMAMBER; // special case this func only
// Manage invert (HIGH on) pins // Manage invert (HIGH on) pins
bool aHigh=sigid & ACTIVE_HIGH_SIGNAL_FLAG; bool aHigh=sighandle & ACTIVE_HIGH_SIGNAL_FLAG;
// set the three pins // set the three pins
if (redpin) { if (redpin) {

View File

@ -187,6 +187,7 @@ class LookList {
static const FSH * getTurntablePositionDescription(int16_t turntableId, uint8_t positionId); static const FSH * getTurntablePositionDescription(int16_t turntableId, uint8_t positionId);
static void startNonRecursiveTask(const FSH* reason, int16_t id,int pc); static void startNonRecursiveTask(const FSH* reason, int16_t id,int pc);
static bool readSensor(uint16_t sensorId); static bool readSensor(uint16_t sensorId);
static bool isSignal(int16_t id,char rag);
private: private:
static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]); static void ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16_t p[]);
@ -196,7 +197,6 @@ private:
static bool getFlag(VPIN id,byte mask); static bool getFlag(VPIN id,byte mask);
static int16_t progtrackLocoId; static int16_t progtrackLocoId;
static void doSignal(int16_t id,char rag); static void doSignal(int16_t id,char rag);
static bool isSignal(int16_t id,char rag);
static int16_t getSignalSlot(int16_t id); static int16_t getSignalSlot(int16_t id);
static void setTurnoutHiddenState(Turnout * t); static void setTurnoutHiddenState(Turnout * t);
#ifndef IO_NO_HAL #ifndef IO_NO_HAL

View File

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

View File

@ -51,6 +51,7 @@ static void create(I2CAddress i2cAddress) {
// Start by assuming we will find the clock // Start by assuming we will find the clock
// Check if specified I2C address is responding (blocking operation) // Check if specified I2C address is responding (blocking operation)
// Returns I2C_STATUS_OK (0) if OK, or error code. // Returns I2C_STATUS_OK (0) if OK, or error code.
I2CManager.begin();
uint8_t _checkforclock = I2CManager.checkAddress(i2cAddress); uint8_t _checkforclock = I2CManager.checkAddress(i2cAddress);
DIAG(F("Clock check result - %d"), _checkforclock); DIAG(F("Clock check result - %d"), _checkforclock);
// XXXX change thistosave2 bytes // XXXX change thistosave2 bytes

View File

@ -35,7 +35,7 @@
#define APPLY_BY_MODE(findmode,function) \ #define APPLY_BY_MODE(findmode,function) \
FOR_EACH_TRACK(t) \ FOR_EACH_TRACK(t) \
if (track[t]->getMode()==findmode) \ if (track[t]->getMode() & findmode) \
track[t]->function; track[t]->function;
MotorDriver * TrackManager::track[MAX_TRACKS] = { NULL }; MotorDriver * TrackManager::track[MAX_TRACKS] = { NULL };
@ -398,7 +398,7 @@ bool TrackManager::parseEqualSign(Print *stream, int16_t params, int16_t p[])
if (params==2 && p[1]=="AUTO"_hk) // <= id AUTO> if (params==2 && p[1]=="AUTO"_hk) // <= id AUTO>
return setTrackMode(p[0], track[p[0]]->getMode() | TRACK_MODE_AUTOINV); return setTrackMode(p[0], track[p[0]]->getMode() | TRACK_MODE_AUTOINV);
if (params==2 && p[1]=="INV"_hk) // <= id AUTO> if (params==2 && p[1]=="INV"_hk) // <= id INV>
return setTrackMode(p[0], track[p[0]]->getMode() | TRACK_MODE_INV); return setTrackMode(p[0], track[p[0]]->getMode() | TRACK_MODE_INV);
if (params==3 && p[1]=="DC"_hk && p[2]>0) // <= id DC cab> if (params==3 && p[1]=="DC"_hk && p[2]>0) // <= id DC cab>

View File

@ -3,7 +3,14 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.51" #define VERSION "5.2.57"
// 5.2.57 - Bugfix autoreverse: Apply mode by binart bit match and not by equality
// 5.2.56 - Bugfix and refactor for EXRAIL getSignalSlot
// 5.2.55 - Move EXRAIL isSignal() to public to allow use in STEALTH call
// 5.2.54 - Bugfix for EXRAIL signal handling for active high
// 5.2.53 - Bugfix for EX-Fastclock, call I2CManager.begin() before checking I2C address
// 5.2.52 - Bugfix for ADCee() to handle ADC2 and ADC3 channel inputs on F446ZE and others
// - Add support for ports G and H on STM32 for ADCee() and MotorDriver pins/shadow regs
// 5.2.51 - Bugfix for SIGNAL: Distinguish between sighandle and sigid // 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: