1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2025-02-22 08:46:04 +01:00

Compare commits

..

No commits in common. "e811a65f66096a87d6e7d6e2cebbcc15fe1abdb6" and "2894a34591a819f8e0a6eeeb38b84b39d02839cb" have entirely different histories.

4 changed files with 14 additions and 30 deletions

View File

@ -942,8 +942,7 @@ bool DCC::setMomentum(int locoId,int16_t accelerating, int16_t decelerating) {
} }
// -1 is ok and means this loco should use the default. // -1 is ok and means this loco should use the default.
if (accelerating<-1 || decelerating<-1) return false; if (accelerating<-1 || decelerating<-1) return false;
if (accelerating/MOMENTUM_FACTOR >= MOMENTUM_USE_DEFAULT || if (accelerating>2000 || decelerating>2000) return false;
decelerating/MOMENTUM_FACTOR >= MOMENTUM_USE_DEFAULT) return false;
// Values stored are 255=MOMENTUM_USE_DEFAULT, or millis/MOMENTUM_FACTOR. // Values stored are 255=MOMENTUM_USE_DEFAULT, or millis/MOMENTUM_FACTOR.
// This is to keep the values in a byte rather than int16 // This is to keep the values in a byte rather than int16

View File

@ -1,6 +1,5 @@
/* /*
* © 2022-2024 Paul M Antoine * © 2022-2024 Paul M Antoine
* © 2024 Herb Morton
* © 2021 Mike S * © 2021 Mike S
* © 2021 Fred Decker * © 2021 Fred Decker
* © 2020-2023 Harald Barth * © 2020-2023 Harald Barth
@ -99,7 +98,7 @@ MotorDriver::MotorDriver(int16_t power_pin, byte signal_pin, byte signal_pin2, i
if (HAVE_PORTH(fastSignalPin.inout == &PORTH)) { if (HAVE_PORTH(fastSignalPin.inout == &PORTH)) {
DIAG(F("Found PORTH pin %d"),signalPin); DIAG(F("Found PORTH pin %d"),signalPin);
fastSignalPin.shadowinout = fastSignalPin.inout; fastSignalPin.shadowinout = fastSignalPin.inout;
fastSignalPin.inout = &shadowPORTH; fastSignalPin.inout = &shadowPORTF;
} }
signalPin2=signal_pin2; signalPin2=signal_pin2;

View File

@ -1,8 +1,6 @@
/* /*
* © 2022 Chris Harlow * © 2022 Chris Harlow
* © 2022-2024 Harald Barth * © 2022-2024 Harald Barth
* © 2023-2024 Paul M. Antoine
* © 2024 Herb Morton
* © 2023 Colin Murdoch * © 2023 Colin Murdoch
* All rights reserved. * All rights reserved.
* *
@ -151,8 +149,6 @@ void TrackManager::setDCCSignal( bool on) {
HAVE_PORTD(shadowPORTD=PORTD); HAVE_PORTD(shadowPORTD=PORTD);
HAVE_PORTE(shadowPORTE=PORTE); HAVE_PORTE(shadowPORTE=PORTE);
HAVE_PORTF(shadowPORTF=PORTF); HAVE_PORTF(shadowPORTF=PORTF);
HAVE_PORTG(shadowPORTF=PORTG);
HAVE_PORTH(shadowPORTF=PORTH);
APPLY_BY_MODE(TRACK_MODE_MAIN,setSignal(on)); APPLY_BY_MODE(TRACK_MODE_MAIN,setSignal(on));
HAVE_PORTA(PORTA=shadowPORTA); HAVE_PORTA(PORTA=shadowPORTA);
HAVE_PORTB(PORTB=shadowPORTB); HAVE_PORTB(PORTB=shadowPORTB);
@ -160,8 +156,6 @@ void TrackManager::setDCCSignal( bool on) {
HAVE_PORTD(PORTD=shadowPORTD); HAVE_PORTD(PORTD=shadowPORTD);
HAVE_PORTE(PORTE=shadowPORTE); HAVE_PORTE(PORTE=shadowPORTE);
HAVE_PORTF(PORTF=shadowPORTF); HAVE_PORTF(PORTF=shadowPORTF);
HAVE_PORTG(shadowPORTF=PORTG);
HAVE_PORTH(shadowPORTF=PORTH);
} }
// setPROGSignal(), called from interrupt context // setPROGSignal(), called from interrupt context
@ -173,8 +167,6 @@ void TrackManager::setPROGSignal( bool on) {
HAVE_PORTD(shadowPORTD=PORTD); HAVE_PORTD(shadowPORTD=PORTD);
HAVE_PORTE(shadowPORTE=PORTE); HAVE_PORTE(shadowPORTE=PORTE);
HAVE_PORTF(shadowPORTF=PORTF); HAVE_PORTF(shadowPORTF=PORTF);
HAVE_PORTG(shadowPORTF=PORTG);
HAVE_PORTH(shadowPORTF=PORTH);
APPLY_BY_MODE(TRACK_MODE_PROG,setSignal(on)); APPLY_BY_MODE(TRACK_MODE_PROG,setSignal(on));
HAVE_PORTA(PORTA=shadowPORTA); HAVE_PORTA(PORTA=shadowPORTA);
HAVE_PORTB(PORTB=shadowPORTB); HAVE_PORTB(PORTB=shadowPORTB);
@ -182,8 +174,6 @@ void TrackManager::setPROGSignal( bool on) {
HAVE_PORTD(PORTD=shadowPORTD); HAVE_PORTD(PORTD=shadowPORTD);
HAVE_PORTE(PORTE=shadowPORTE); HAVE_PORTE(PORTE=shadowPORTE);
HAVE_PORTF(PORTF=shadowPORTF); HAVE_PORTF(PORTF=shadowPORTF);
HAVE_PORTG(shadowPORTF=PORTG);
HAVE_PORTH(shadowPORTF=PORTH);
} }
// setDCSignal(), called from normal context // setDCSignal(), called from normal context
@ -641,25 +631,23 @@ void TrackManager::setJoinRelayPin(byte joinRelayPin) {
void TrackManager::setJoin(bool joined) { void TrackManager::setJoin(bool joined) {
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
if (joined) { // if we go into joined mode (PROG acts as MAIN) if (joined) {
FOR_EACH_TRACK(t) { FOR_EACH_TRACK(t) {
if (track[t]->getMode() & TRACK_MODE_PROG) { // find PROG track if (track[t]->getMode() & TRACK_MODE_PROG) {
tempProgTrack = t; // remember PROG track tempProgTrack = t;
setTrackMode(t, TRACK_MODE_MAIN); setTrackMode(t, TRACK_MODE_MAIN);
track[t]->setPower(POWERMODE::ON); // if joined, always on break;
break; // there is only one prog track, done
} }
} }
} else { } else {
if (tempProgTrack != MAX_TRACKS+1) { if (tempProgTrack != MAX_TRACKS+1) {
// setTrackMode defaults to power off, so we // as setTrackMode with TRACK_MODE_PROG defaults to
// need to preserve that state. // power off, we will take the current power state
POWERMODE tPTmode = track[tempProgTrack]->getPower(); // get current power status of this track // of our track and then preserve that state.
setTrackMode(tempProgTrack, TRACK_MODE_PROG); // set track mode back to prog POWERMODE tPTmode = track[tempProgTrack]->getPower(); //get current power status of this track
track[tempProgTrack]->setPower(tPTmode); // set power status as it was before setTrackMode(tempProgTrack, TRACK_MODE_PROG);
track[tempProgTrack]->setPower(tPTmode); //set track status as it was before
tempProgTrack = MAX_TRACKS+1; tempProgTrack = MAX_TRACKS+1;
} else {
DIAG(F("Unjoin but no remembered prog track"));
} }
} }
#endif #endif

View File

@ -3,10 +3,8 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.73M" #define VERSION "5.2.72"
// TBA - Momentum // 5.2.72 - Momentum.
// 5.2.73 - Bugfix: STM32 further fixes to shadowPORT entries in TrackManager.cpp for PORTG and PORTH
// 5.2.72 - Bugfix: added shadowPORT entries in TrackManager.cpp for PORTG and PORTH on STM32, fixed typo in MotorDriver.cpp
// 5.2.71 - Broadcasts of loco forgets. // 5.2.71 - Broadcasts of loco forgets.
// 5.2.70 - IO_RocoDriver renamed to IO_EncoderThrottle. // 5.2.70 - IO_RocoDriver renamed to IO_EncoderThrottle.
// - and included in IODEvice.h (circular dependency removed) // - and included in IODEvice.h (circular dependency removed)