From f39fd89fbd466f2008d026d322598d0992b0efaf Mon Sep 17 00:00:00 2001 From: pmantoine Date: Thu, 25 Jul 2024 13:58:04 +0800 Subject: [PATCH] STM32 bugfix for PORTG and PORTH with thanks to Ash --- MotorDriver.cpp | 3 ++- TrackManager.cpp | 10 ++++++++++ version.h | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) 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 61cf7c8..dcb7c69 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_PORTF(shadowPORTF=PORTG); + HAVE_PORTF(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_PORTF(shadowPORTF=PORTG); + HAVE_PORTF(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_PORTF(shadowPORTF=PORTG); + HAVE_PORTF(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_PORTF(shadowPORTF=PORTG); + HAVE_PORTF(shadowPORTF=PORTH); } // setDCSignal(), called from normal context diff --git a/version.h b/version.h index 52fbbb9..184dad6 100644 --- a/version.h +++ b/version.h @@ -3,7 +3,8 @@ #include "StringFormatter.h" -#define VERSION "5.2.71" +#define VERSION "5.2.72" +// 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)