1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 21:01:25 +01:00
This commit is contained in:
Asbelos 2024-04-06 23:41:33 +01:00
commit 3317b4666e
3 changed files with 15 additions and 8 deletions

View File

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

View File

@ -38,8 +38,8 @@
if (track[t]->getMode()==findmode) \
track[t]->function;
MotorDriver * TrackManager::track[MAX_TRACKS];
int16_t TrackManager::trackDCAddr[MAX_TRACKS];
MotorDriver * TrackManager::track[MAX_TRACKS] = { NULL };
int16_t TrackManager::trackDCAddr[MAX_TRACKS] = { 0 };
int8_t TrackManager::lastTrack=-1;
bool TrackManager::progTrackSyncMain=false;
@ -251,7 +251,6 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
} else {
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
// 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)
if (mode & TRACK_MODE_DC) {
if (trackDCAddr[trackToSet] != dcAddr) {
// if we change dcAddr, detach first old signal
track[trackToSet]->detachDCSignal();
// new or changed DC Addr, run the new setup
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
int trackfound = -1;
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.
track[trackToSet]->detachDCSignal();
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:
// Leave it as is

View File

@ -3,8 +3,9 @@
#include "StringFormatter.h"
#define VERSION "5.2.44"
// 5.2.44 - ESP32 fix PWM LEDC inverted pin mode
#define VERSION "5.2.45"
// 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
// 5.2.42 - ESP32 Bugfix: Uninitialized stack variable
// 5.2.41 - Update rotary encoder default address to 0x67