mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Compare commits
3 Commits
e4a3aa9f1e
...
6b713bf57c
Author | SHA1 | Date | |
---|---|---|---|
|
6b713bf57c | ||
|
38a9585a41 | ||
|
1a307eea3d |
43
DCC.cpp
43
DCC.cpp
|
@ -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ür den ersten erweiterten Zubehördecoder ist wie bei den einfachen
|
Die Adresse f<EFBFBD>r den ersten erweiterten Zubeh<EFBFBD>rdecoder ist wie bei den einfachen
|
||||||
Zubehördecodern die Adresse 4 = 1000-0001 0111-0001 . Diese Adresse wird in
|
Zubeh<EFBFBD>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,6 +500,36 @@ 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)
|
||||||
|
@ -566,6 +596,10 @@ 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
|
||||||
|
@ -583,7 +617,10 @@ 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
|
// 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 decoder without cv19 support
|
WB,WACK, // ignore decoder without cv19 support
|
||||||
|
|
17
DCCACK.cpp
17
DCCACK.cpp
|
@ -314,6 +314,14 @@ 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
|
||||||
|
@ -322,6 +330,15 @@ 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:
|
||||||
|
|
2
DCCACK.h
2
DCCACK.h
|
@ -56,6 +56,8 @@ 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
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-202404051830Z"
|
#define GITHUB_SHA "devel-202404061747Z"
|
||||||
|
|
|
@ -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];
|
MotorDriver * TrackManager::track[MAX_TRACKS] = { NULL };
|
||||||
int16_t TrackManager::trackDCAddr[MAX_TRACKS];
|
int16_t TrackManager::trackDCAddr[MAX_TRACKS] = { 0 };
|
||||||
|
|
||||||
int8_t TrackManager::lastTrack=-1;
|
int8_t TrackManager::lastTrack=-1;
|
||||||
bool TrackManager::progTrackSyncMain=false;
|
bool TrackManager::progTrackSyncMain=false;
|
||||||
|
@ -251,7 +251,6 @@ 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.
|
||||||
|
@ -259,8 +258,13 @@ 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) {
|
||||||
// if we change dcAddr, detach first old signal
|
// new or changed DC Addr, run the new setup
|
||||||
track[trackToSet]->detachDCSignal();
|
if (trackDCAddr[trackToSet] != 0) {
|
||||||
|
// 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) {
|
||||||
|
@ -285,7 +289,9 @@ 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
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.44"
|
#define VERSION "5.2.45"
|
||||||
// 5.2.44 - ESP32 fix PWM LEDC inverted pin mode
|
// 5.2.45 - ESP32 Trackmanager reset cab number to 0 when track is not DC
|
||||||
|
// 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user