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

Compare commits

..

No commits in common. "6b713bf57c95565879fb5cbe2552ffa71d9b8d00" and "e4a3aa9f1e42afc248e75c88aba428d2c599c065" have entirely different histories.

6 changed files with 11 additions and 74 deletions

43
DCC.cpp
View File

@ -325,8 +325,8 @@ preamble -0- 1 0 A7 A6 A5 A4 A3 A2 -0- 0 ^A10 ^A9 ^A8 0 A1 A0 1 -0- ....
Thus in byte packet form the format is 10AAAAAA, 0AAA0AA1, 000XXXXX Thus in byte packet form the format is 10AAAAAA, 0AAA0AA1, 000XXXXX
Die Adresse f<EFBFBD>r den ersten erweiterten Zubeh<EFBFBD>rdecoder ist wie bei den einfachen Die Adresse für den ersten erweiterten Zubehördecoder ist wie bei den einfachen
Zubeh<EFBFBD>rdecodern die Adresse 4 = 1000-0001 0111-0001 . Diese Adresse wird in Zubehördecodern die Adresse 4 = 1000-0001 0111-0001 . Diese Adresse wird in
Anwenderdialogen als Adresse 1 dargestellt. Anwenderdialogen als Adresse 1 dargestellt.
This means that the first address shown to the user as "1" is mapped This means that the first address shown to the user as "1" is mapped
@ -500,36 +500,6 @@ const ackOp FLASH READ_CV_PROG[] = {
const ackOp FLASH LOCO_ID_PROG[] = { const ackOp FLASH LOCO_ID_PROG[] = {
BASELINE, BASELINE,
// first check cv20 for extended addressing
SETCV, (ackOp)20, // CV 19 is extended
SETBYTE, (ackOp)0,
VB, WACK, ITSKIP, // skip past extended section if cv20 is zero
// read cv20 and 19 and merge
STARTMERGE, // Setup to read cv 20
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
VB, WACK, NAKSKIP, // bad read of cv20, assume its 0
STASHLOCOID, // keep cv 20 until we have cv19 as well.
SETCV, (ackOp)19,
STARTMERGE, // Setup to read cv 19
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
V0, WACK, MERGE,
VB, WACK, NAKFAIL, // cant recover if cv 19 unreadable
COMBINE1920, // Combile byte with stash and callback
// end of advanced 20,19 check
SKIPTARGET,
SETCV, (ackOp)19, // CV 19 is consist setting SETCV, (ackOp)19, // CV 19 is consist setting
SETBYTE, (ackOp)0, SETBYTE, (ackOp)0,
VB, WACK, ITSKIP, // ignore consist if cv19 is zero (no consist) VB, WACK, ITSKIP, // ignore consist if cv19 is zero (no consist)
@ -596,10 +566,6 @@ const ackOp FLASH LOCO_ID_PROG[] = {
const ackOp FLASH SHORT_LOCO_ID_PROG[] = { const ackOp FLASH SHORT_LOCO_ID_PROG[] = {
BASELINE, BASELINE,
// Clear consist CV 19,20
SETCV,(ackOp)20,
SETBYTE, (ackOp)0,
WB,WACK, // ignore dedcoder without cv20 support
SETCV,(ackOp)19, SETCV,(ackOp)19,
SETBYTE, (ackOp)0, SETBYTE, (ackOp)0,
WB,WACK, // ignore dedcoder without cv19 support WB,WACK, // ignore dedcoder without cv19 support
@ -617,10 +583,7 @@ const ackOp FLASH SHORT_LOCO_ID_PROG[] = {
const ackOp FLASH LONG_LOCO_ID_PROG[] = { const ackOp FLASH LONG_LOCO_ID_PROG[] = {
BASELINE, BASELINE,
// Clear consist CV 19,20 // Clear consist CV 19
SETCV,(ackOp)20,
SETBYTE, (ackOp)0,
WB,WACK, // ignore dedcoder without cv20 support
SETCV,(ackOp)19, SETCV,(ackOp)19,
SETBYTE, (ackOp)0, SETBYTE, (ackOp)0,
WB,WACK, // ignore decoder without cv19 support WB,WACK, // ignore decoder without cv19 support

View File

@ -314,14 +314,6 @@ void DCCACK::loop() {
callback( LONG_ADDR_MARKER | ( ackManagerByte + ((ackManagerStash - 192) << 8))); callback( LONG_ADDR_MARKER | ( ackManagerByte + ((ackManagerStash - 192) << 8)));
return; return;
case COMBINE1920:
// ackManagerStash is cv20, ackManagerByte is CV 19
// This will not be called if cv20==0
ackManagerByte &= 0x7F; // ignore direction marker
ackManagerByte %=100; // take last 2 decimal digits
callback( ackManagerStash*100+ackManagerByte);
return;
case ITSKIP: case ITSKIP:
if (!ackReceived) break; if (!ackReceived) break;
// SKIP opcodes until SKIPTARGET found // SKIP opcodes until SKIPTARGET found
@ -330,15 +322,6 @@ void DCCACK::loop() {
opcode=GETFLASH(ackManagerProg); opcode=GETFLASH(ackManagerProg);
} }
break; break;
case NAKSKIP:
if (ackReceived) break;
// SKIP opcodes until SKIPTARGET found
while (opcode!=SKIPTARGET) {
ackManagerProg++;
opcode=GETFLASH(ackManagerProg);
}
break;
case SKIPTARGET: case SKIPTARGET:
break; break;
default: default:

View File

@ -56,8 +56,6 @@ enum ackOp : byte
STASHLOCOID, // keeps current byte value for later STASHLOCOID, // keeps current byte value for later
COMBINELOCOID, // combines current value with stashed value and returns it COMBINELOCOID, // combines current value with stashed value and returns it
ITSKIP, // skip to SKIPTARGET if ack true ITSKIP, // skip to SKIPTARGET if ack true
NAKSKIP, // skip to SKIPTARGET if ack false
COMBINE1920, // combine cvs 19 and 20 and callback
SKIPTARGET = 0xFF // jump to target SKIPTARGET = 0xFF // jump to target
}; };

View File

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

View File

@ -38,8 +38,8 @@
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];
int16_t TrackManager::trackDCAddr[MAX_TRACKS] = { 0 }; int16_t TrackManager::trackDCAddr[MAX_TRACKS];
int8_t TrackManager::lastTrack=-1; int8_t TrackManager::lastTrack=-1;
bool TrackManager::progTrackSyncMain=false; bool TrackManager::progTrackSyncMain=false;
@ -251,6 +251,7 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
} else { } else {
track[trackToSet]->makeProgTrack(false); // only the prog track knows it's type track[trackToSet]->makeProgTrack(false); // only the prog track knows it's type
} }
track[trackToSet]->setMode(mode);
// When a track is switched, we must clear any side effects of its previous // When a track is switched, we must clear any side effects of its previous
// state, otherwise trains run away or just dont move. // state, otherwise trains run away or just dont move.
@ -258,13 +259,8 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
// This can be done BEFORE the PWM-Timer evaluation (methinks) // This can be done BEFORE the PWM-Timer evaluation (methinks)
if (mode & TRACK_MODE_DC) { if (mode & TRACK_MODE_DC) {
if (trackDCAddr[trackToSet] != dcAddr) { if (trackDCAddr[trackToSet] != dcAddr) {
// new or changed DC Addr, run the new setup // if we change dcAddr, detach first old signal
if (trackDCAddr[trackToSet] != 0) { track[trackToSet]->detachDCSignal();
// if we change dcAddr and not only
// change from another mode,
// first detach old DC signal
track[trackToSet]->detachDCSignal();
}
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
int trackfound = -1; int trackfound = -1;
FOR_EACH_TRACK(t) { FOR_EACH_TRACK(t) {
@ -289,9 +285,7 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
// DCC tracks need to have set the PWM to zero or they will not work. // DCC tracks need to have set the PWM to zero or they will not work.
track[trackToSet]->detachDCSignal(); track[trackToSet]->detachDCSignal();
track[trackToSet]->setBrake(false); track[trackToSet]->setBrake(false);
trackDCAddr[trackToSet]=0; // clear that an addr is set for DC as this is not a DC track
} }
track[trackToSet]->setMode(mode);
// BOOST: // BOOST:
// Leave it as is // Leave it as is

View File

@ -3,9 +3,8 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.45" #define VERSION "5.2.44"
// 5.2.45 - ESP32 Trackmanager reset cab number to 0 when track is not DC // 5.2.44 - ESP32 fix PWM LEDC inverted pin mode
// ESP32 fix PWM LEDC inverted pin mode
// ESP32 rewrite PWM LEDC to use pin mux // ESP32 rewrite PWM LEDC to use pin mux
// 5.2.42 - ESP32 Bugfix: Uninitialized stack variable // 5.2.42 - ESP32 Bugfix: Uninitialized stack variable
// 5.2.41 - Update rotary encoder default address to 0x67 // 5.2.41 - Update rotary encoder default address to 0x67