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

Merge branch 'devel_momentum' into devel_blockenter

This commit is contained in:
Asbelos 2024-08-06 15:36:56 +01:00
commit b94e8c572a
3 changed files with 28 additions and 13 deletions

View File

@ -1,5 +1,6 @@
/* /*
* © 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
@ -98,7 +99,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 = &shadowPORTF; fastSignalPin.inout = &shadowPORTH;
} }
signalPin2=signal_pin2; signalPin2=signal_pin2;

View File

@ -1,6 +1,8 @@
/* /*
* © 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.
* *
@ -149,6 +151,8 @@ 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);
@ -156,6 +160,8 @@ 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
@ -167,6 +173,8 @@ 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);
@ -174,6 +182,8 @@ 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
@ -631,23 +641,25 @@ 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 (joined) { // if we go into joined mode (PROG acts as MAIN)
FOR_EACH_TRACK(t) { FOR_EACH_TRACK(t) {
if (track[t]->getMode() & TRACK_MODE_PROG) { if (track[t]->getMode() & TRACK_MODE_PROG) { // find PROG track
tempProgTrack = t; tempProgTrack = t; // remember PROG track
setTrackMode(t, TRACK_MODE_MAIN); setTrackMode(t, TRACK_MODE_MAIN);
break; track[t]->setPower(POWERMODE::ON); // if joined, always on
break; // there is only one prog track, done
} }
} }
} else { } else {
if (tempProgTrack != MAX_TRACKS+1) { if (tempProgTrack != MAX_TRACKS+1) {
// as setTrackMode with TRACK_MODE_PROG defaults to // setTrackMode defaults to power off, so we
// power off, we will take the current power state // need to preserve that state.
// of our track and then preserve that state. POWERMODE tPTmode = track[tempProgTrack]->getPower(); // get current power status of this track
POWERMODE tPTmode = track[tempProgTrack]->getPower(); //get current power status of this track setTrackMode(tempProgTrack, TRACK_MODE_PROG); // set track mode back to prog
setTrackMode(tempProgTrack, TRACK_MODE_PROG); track[tempProgTrack]->setPower(tPTmode); // set power status as it was before
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,8 +3,10 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.72" #define VERSION "5.2.73M"
// 5.2.72 - Momentum. // TBA - 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)