diff --git a/GITHUB_SHA.h b/GITHUB_SHA.h index b09405c..febb419 100644 --- a/GITHUB_SHA.h +++ b/GITHUB_SHA.h @@ -1 +1 @@ -#define GITHUB_SHA "devel-fozzie-202408071912Z" +#define GITHUB_SHA "devel-fozzie-202408080852Z" diff --git a/MotorDriver.cpp b/MotorDriver.cpp index 28fbfa3..749c425 100644 --- a/MotorDriver.cpp +++ b/MotorDriver.cpp @@ -1,5 +1,6 @@ /* * © 2022-2024 Paul M Antoine + * © 2024 Herb Morton * © 2021 Mike S * © 2021 Fred Decker * © 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)) { DIAG(F("Found PORTH pin %d"),signalPin); fastSignalPin.shadowinout = fastSignalPin.inout; - fastSignalPin.inout = &shadowPORTF; + fastSignalPin.inout = &shadowPORTH; } signalPin2=signal_pin2; diff --git a/TrackManager.cpp b/TrackManager.cpp index 512452d..ba9776b 100644 --- a/TrackManager.cpp +++ b/TrackManager.cpp @@ -1,6 +1,8 @@ /* * © 2022 Chris Harlow * © 2022-2024 Harald Barth + * © 2023-2024 Paul M. Antoine + * © 2024 Herb Morton * © 2023 Colin Murdoch * All rights reserved. * @@ -149,6 +151,8 @@ void TrackManager::setDCCSignal( bool on) { HAVE_PORTD(shadowPORTD=PORTD); HAVE_PORTE(shadowPORTE=PORTE); HAVE_PORTF(shadowPORTF=PORTF); + HAVE_PORTG(shadowPORTF=PORTG); + HAVE_PORTH(shadowPORTF=PORTH); APPLY_BY_MODE(TRACK_MODE_MAIN,setSignal(on)); HAVE_PORTA(PORTA=shadowPORTA); HAVE_PORTB(PORTB=shadowPORTB); @@ -156,6 +160,8 @@ void TrackManager::setDCCSignal( bool on) { HAVE_PORTD(PORTD=shadowPORTD); HAVE_PORTE(PORTE=shadowPORTE); HAVE_PORTF(PORTF=shadowPORTF); + HAVE_PORTG(shadowPORTF=PORTG); + HAVE_PORTH(shadowPORTF=PORTH); } // setPROGSignal(), called from interrupt context @@ -167,6 +173,8 @@ void TrackManager::setPROGSignal( bool on) { HAVE_PORTD(shadowPORTD=PORTD); HAVE_PORTE(shadowPORTE=PORTE); HAVE_PORTF(shadowPORTF=PORTF); + HAVE_PORTG(shadowPORTF=PORTG); + HAVE_PORTH(shadowPORTF=PORTH); APPLY_BY_MODE(TRACK_MODE_PROG,setSignal(on)); HAVE_PORTA(PORTA=shadowPORTA); HAVE_PORTB(PORTB=shadowPORTB); @@ -174,6 +182,8 @@ void TrackManager::setPROGSignal( bool on) { HAVE_PORTD(PORTD=shadowPORTD); HAVE_PORTE(PORTE=shadowPORTE); HAVE_PORTF(PORTF=shadowPORTF); + HAVE_PORTG(shadowPORTF=PORTG); + HAVE_PORTH(shadowPORTF=PORTH); } // setDCSignal(), called from normal context @@ -631,23 +641,25 @@ void TrackManager::setJoinRelayPin(byte joinRelayPin) { void TrackManager::setJoin(bool joined) { #ifdef ARDUINO_ARCH_ESP32 - if (joined) { + if (joined) { // if we go into joined mode (PROG acts as MAIN) FOR_EACH_TRACK(t) { - if (track[t]->getMode() & TRACK_MODE_PROG) { - tempProgTrack = t; + if (track[t]->getMode() & TRACK_MODE_PROG) { // find PROG track + tempProgTrack = t; // remember PROG track setTrackMode(t, TRACK_MODE_MAIN); - break; + track[t]->setPower(POWERMODE::ON); // if joined, always on + break; // there is only one prog track, done } } } else { if (tempProgTrack != MAX_TRACKS+1) { - // as setTrackMode with TRACK_MODE_PROG defaults to - // power off, we will take the current power state - // of our track and then preserve that state. - POWERMODE tPTmode = track[tempProgTrack]->getPower(); //get current power status of this track - setTrackMode(tempProgTrack, TRACK_MODE_PROG); - track[tempProgTrack]->setPower(tPTmode); //set track status as it was before + // setTrackMode defaults to power off, so we + // need to preserve that state. + POWERMODE tPTmode = track[tempProgTrack]->getPower(); // get current power status of this track + setTrackMode(tempProgTrack, TRACK_MODE_PROG); // set track mode back to prog + track[tempProgTrack]->setPower(tPTmode); // set power status as it was before tempProgTrack = MAX_TRACKS+1; + } else { + DIAG(F("Unjoin but no remembered prog track")); } } #endif diff --git a/version.h b/version.h index 52fbbb9..4d42e30 100644 --- a/version.h +++ b/version.h @@ -3,7 +3,10 @@ #include "StringFormatter.h" -#define VERSION "5.2.71" +#define VERSION "5.2.74" +// 5.2.74 - Bugfix: ESP32 turn on the joined prog (as main) again after a prog operation +// 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.70 - IO_RocoDriver renamed to IO_EncoderThrottle. // - and included in IODEvice.h (circular dependency removed)