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

Compare commits

..

1 Commits

9 changed files with 11 additions and 45 deletions

View File

@ -67,10 +67,6 @@ CALLBACK_STATE DCCACK::callbackState=READY;
ACK_CALLBACK DCCACK::ackManagerCallback; ACK_CALLBACK DCCACK::ackManagerCallback;
void DCCACK::Setup(int cv, byte byteValueOrBitnum, ackOp const program[], ACK_CALLBACK callback) { void DCCACK::Setup(int cv, byte byteValueOrBitnum, ackOp const program[], ACK_CALLBACK callback) {
// On ESP32 the joined track is hidden from sight (it has type MAIN)
// and because of that we need first check if track was joined and
// then unjoin if necessary. This requires that the joined flag is
// cleared when the prog track is removed.
ackManagerRejoin=TrackManager::isJoined(); ackManagerRejoin=TrackManager::isJoined();
if (ackManagerRejoin) { if (ackManagerRejoin) {
// Change from JOIN must zero resets packet. // Change from JOIN must zero resets packet.

View File

@ -1328,7 +1328,7 @@ void RMFT2::clockEvent(int16_t clocktime, bool change) {
void RMFT2::powerEvent(int16_t track, bool overload) { void RMFT2::powerEvent(int16_t track, bool overload) {
// Hunt for an ONOVERLOAD for this item // Hunt for an ONOVERLOAD for this item
if (Diag::CMD) if (Diag::CMD)
DIAG(F("powerEvent : %c"), track + 'A'); DIAG(F("powerEvent : %c"), track);
if (overload) { if (overload) {
onOverloadLookup->handleEvent(F("POWER"),track); onOverloadLookup->handleEvent(F("POWER"),track);
} }

View File

@ -516,7 +516,7 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
#ifndef IO_NO_HAL #ifndef IO_NO_HAL
#define EXTT_TURNTABLE(id,vpin,home,description...) OPCODE_EXTTTURNTABLE,V(id),OPCODE_PAD,V(vpin),OPCODE_PAD,V(home), #define EXTT_TURNTABLE(id,vpin,home,description...) OPCODE_EXTTTURNTABLE,V(id),OPCODE_PAD,V(vpin),OPCODE_PAD,V(home),
#endif #endif
#define FADE(pin,value,ms) OPCODE_SERVO,V(pin),OPCODE_PAD,V(value),OPCODE_PAD,V((int16_t)PCA9685::ProfileType::UseDuration|(int16_t)PCA9685::ProfileType::NoPowerOff),OPCODE_PAD,V(ms/100L), #define FADE(pin,value,ms) OPCODE_SERVO,V(pin),OPCODE_PAD,V(value),OPCODE_PAD,V(PCA9685::ProfileType::UseDuration|PCA9685::NoPowerOff),OPCODE_PAD,V(ms/100L),
#define FOFF(func) OPCODE_FOFF,V(func), #define FOFF(func) OPCODE_FOFF,V(func),
#define FOLLOW(route) OPCODE_FOLLOW,V(route), #define FOLLOW(route) OPCODE_FOLLOW,V(route),
#define FON(func) OPCODE_FON,V(func), #define FON(func) OPCODE_FON,V(func),

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-202412221258Z" #define GITHUB_SHA "devel-202411091200Z"

View File

@ -38,7 +38,6 @@
#include "FSH.h" #include "FSH.h"
#include "I2CManager.h" #include "I2CManager.h"
#include "inttypes.h" #include "inttypes.h"
#include "TemplateForEnums.h"
typedef uint16_t VPIN; typedef uint16_t VPIN;
// Limit VPIN number to max 32767. Above this number, printing often gives negative values. // Limit VPIN number to max 32767. Above this number, printing often gives negative values.

View File

@ -28,9 +28,12 @@
#include "DCCTimer.h" #include "DCCTimer.h"
#include <wiring_private.h> #include <wiring_private.h>
#include "TemplateForEnums.h"
// use powers of two so we can do logical and/or on the track modes in if clauses. // use powers of two so we can do logical and/or on the track modes in if clauses.
// For example TRACK_MODE_DC_INV is (TRACK_MODE_DC|TRACK_MODIFIER_INV) // For example TRACK_MODE_DC_INV is (TRACK_MODE_DC|TRACK_MODIFIER_INV)
template<class T> inline T operator~ (T a) { return (T)~(int)a; }
template<class T> inline T operator| (T a, T b) { return (T)((int)a | (int)b); }
template<class T> inline T operator& (T a, T b) { return (T)((int)a & (int)b); }
template<class T> inline T operator^ (T a, T b) { return (T)((int)a ^ (int)b); }
enum TRACK_MODE : byte { enum TRACK_MODE : byte {
// main modes // main modes
TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PROG = 4, TRACK_MODE_NONE = 1, TRACK_MODE_MAIN = 2, TRACK_MODE_PROG = 4,

View File

@ -1,26 +0,0 @@
/*
* © 2024, Harald Barth. All rights reserved.
*
* This file is part of DCC-EX
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* It is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TemplateForEnums
#define TemplateForEnums
template<class T> inline T operator~ (T a) { return (T)~(int)a; }
template<class T> inline T operator| (T a, T b) { return (T)((int)a | (int)b); }
template<class T> inline T operator& (T a, T b) { return (T)((int)a & (int)b); }
template<class T> inline T operator^ (T a, T b) { return (T)((int)a ^ (int)b); }
#endif

View File

@ -246,6 +246,9 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
#endif #endif
#ifndef DISABLE_PROG #ifndef DISABLE_PROG
if (mode & TRACK_MODE_PROG) { if (mode & TRACK_MODE_PROG) {
#else
if (false) {
#endif
// only allow 1 track to be prog // only allow 1 track to be prog
FOR_EACH_TRACK(t) FOR_EACH_TRACK(t)
if ( (track[t]->getMode() & TRACK_MODE_PROG) && t != trackToSet) { if ( (track[t]->getMode() & TRACK_MODE_PROG) && t != trackToSet) {
@ -258,7 +261,6 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
} else { } else {
track[trackToSet]->makeProgTrack(false); // only the prog track knows it's type track[trackToSet]->makeProgTrack(false); // only the prog track knows it's type
} }
#endif
// When a track is switched, we must clear any side effects of its previous // When a track is switched, we must clear any side effects of its previous
// state, otherwise trains run away or just dont move. // state, otherwise trains run away or just dont move.
@ -361,12 +363,6 @@ bool TrackManager::setTrackMode(byte trackToSet, TRACK_MODE mode, int16_t dcAddr
track[trackToSet]->setPower(POWERMODE::OFF); track[trackToSet]->setPower(POWERMODE::OFF);
streamTrackState(NULL,trackToSet); streamTrackState(NULL,trackToSet);
#ifndef DISABLE_PROG
// If no prog track exists, the join flag should not say that
// the prog track is joined either, so clear flag here
if (getProgDriver() == NULL) progTrackSyncMain=false;
#endif
//DIAG(F("TrackMode=%d"),mode); //DIAG(F("TrackMode=%d"),mode);
return true; return true;
} }

View File

@ -3,9 +3,7 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.2.93" #define VERSION "5.2.91"
// 5.2.93 - Bugfix ESP32: clear progTrackSyncMain (join flag) when prog track is removed
// 5.2.92 - Bugfix: FADE power off fix, EXRAIL power diagnostic fix.
// 5.2.91 - Bugfix: Neopixel I2C overlap check // 5.2.91 - Bugfix: Neopixel I2C overlap check
// 5.2.90 - Bugfix: EXRAIL EXTT_TURNTABLE() now has description as optional in line with ocumentation (also fixed DCC_TURNTABLE) // 5.2.90 - Bugfix: EXRAIL EXTT_TURNTABLE() now has description as optional in line with ocumentation (also fixed DCC_TURNTABLE)
// 5.2.89 - EXRAIL SET(vpin[,npins]) RESET(vpin,[,npins]) pin range manipulation // 5.2.89 - EXRAIL SET(vpin[,npins]) RESET(vpin,[,npins]) pin range manipulation