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

Compare commits

..

No commits in common. "cc5ad8fae590becc914787e42cc78f11e14d4f53" and "ab1a13775e342be9376166d27ab22d275ad4d413" have entirely different histories.

11 changed files with 39 additions and 47 deletions

View File

@ -209,7 +209,9 @@ int16_t CommandDistributor::retClockTime() {
void CommandDistributor::broadcastLoco(byte slot) { void CommandDistributor::broadcastLoco(byte slot) {
DCC::LOCO * sp=&DCC::speedTable[slot]; DCC::LOCO * sp=&DCC::speedTable[slot];
broadcastReply(COMMAND_TYPE, F("<l %d %d %d %l>\n"), sp->loco,slot,sp->speedCode,sp->functions); uint32_t func = sp->functions;
func = func & 0x1fffffff; // mask out bits 0-28
broadcastReply(COMMAND_TYPE, F("<l %d %d %d %l>\n"), sp->loco,slot,sp->speedCode,func);
#ifdef SABERTOOTH #ifdef SABERTOOTH
if (Serial2 && sp->loco == SABERTOOTH) { if (Serial2 && sp->loco == SABERTOOTH) {
static uint8_t rampingmode = 0; static uint8_t rampingmode = 0;

View File

@ -219,8 +219,7 @@ bool DCC::setFn( int cab, int16_t functionNumber, bool on) {
} else { } else {
speedTable[reg].functions &= ~funcmask; speedTable[reg].functions &= ~funcmask;
} }
if (speedTable[reg].functions != previous) { if (speedTable[reg].functions != previous && functionNumber <= 28) {
if (functionNumber <= 28)
updateGroupflags(speedTable[reg].groupFlags, functionNumber); updateGroupflags(speedTable[reg].groupFlags, functionNumber);
CommandDistributor::broadcastLoco(reg); CommandDistributor::broadcastLoco(reg);
} }
@ -236,14 +235,14 @@ void DCC::changeFn( int cab, int16_t functionNumber) {
speedTable[reg].functions ^= funcmask; speedTable[reg].functions ^= funcmask;
if (functionNumber <= 28) { if (functionNumber <= 28) {
updateGroupflags(speedTable[reg].groupFlags, functionNumber); updateGroupflags(speedTable[reg].groupFlags, functionNumber);
}
CommandDistributor::broadcastLoco(reg); CommandDistributor::broadcastLoco(reg);
}
} }
// Report function state (used from withrottle protocol) // Report function state (used from withrottle protocol)
// returns 0 false, 1 true or -1 for do not know // returns 0 false, 1 true or -1 for do not know
int8_t DCC::getFn( int cab, int16_t functionNumber) { int8_t DCC::getFn( int cab, int16_t functionNumber) {
if (cab<=0 || functionNumber>31) if (cab<=0 || functionNumber>28)
return -1; // unknown return -1; // unknown
int reg = lookupSpeedTable(cab); int reg = lookupSpeedTable(cab);
if (reg<0) if (reg<0)

View File

@ -68,7 +68,7 @@ Once a new OPCODE is decided upon, update this list.
K, Reserved for future use - Potentially Railcom K, Reserved for future use - Potentially Railcom
l, Loco speedbyte/function map broadcast l, Loco speedbyte/function map broadcast
L, Reserved for LCC interface (implemented in EXRAIL) L, Reserved for LCC interface (implemented in EXRAIL)
m, message to throttles broadcast m,
M, Write DCC packet M, Write DCC packet
n, n,
N, N,
@ -283,22 +283,25 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
return; // filterCallback asked us to ignore return; // filterCallback asked us to ignore
case 't': // THROTTLE <t [REGISTER] CAB SPEED DIRECTION> case 't': // THROTTLE <t [REGISTER] CAB SPEED DIRECTION>
{ {
int16_t cab;
int16_t tspeed;
int16_t direction;
if (params==1) { // <t cab> display state if (params==1) { // <t cab> display state
int16_t slot=DCC::lookupSpeedTable(p[0],false); int16_t slot=DCC::lookupSpeedTable(p[0],false);
if (slot>=0) if (slot>=0) {
CommandDistributor::broadcastLoco(slot); DCC::LOCO * sp=&DCC::speedTable[slot];
StringFormatter::send(stream,F("<l %d %d %d %l>\n"),
sp->loco,slot,sp->speedCode,sp->functions);
}
else // send dummy state speed 0 fwd no functions. else // send dummy state speed 0 fwd no functions.
StringFormatter::send(stream,F("<l %d -1 128 0>\n"),p[0]); StringFormatter::send(stream,F("<l %d -1 128 0>\n"),p[0]);
return; return;
} }
int16_t cab;
int16_t tspeed;
int16_t direction;
if (params == 4) if (params == 4)
{ // <t REGISTER CAB SPEED DIRECTION> { // <t REGISTER CAB SPEED DIRECTION>
// ignore register p[0]
cab = p[1]; cab = p[1];
tspeed = p[2]; tspeed = p[2];
direction = p[3]; direction = p[3];

View File

@ -1 +1 @@
#define GITHUB_SHA "devel-stm32ECa-202403240600Z" #define GITHUB_SHA "devel-stm32ECa-202403082308Z"

View File

@ -42,9 +42,9 @@
* Defining in myAutomation.h requires the device driver to be included in addition to the HAL() statement. Examples: * Defining in myAutomation.h requires the device driver to be included in addition to the HAL() statement. Examples:
* *
* #include "IO_RotaryEncoder.h" * #include "IO_RotaryEncoder.h"
* HAL(RotaryEncoder, 700, 1, 0x67) // Define single Vpin, no feedback or position sent to rotary encoder software * HAL(RotaryEncoder, 700, 1, 0x70) // Define single Vpin, no feedback or position sent to rotary encoder software
* HAL(RotaryEncoder, 700, 2, 0x67) // Define two Vpins, feedback only sent to rotary encoder software * HAL(RotaryEncoder, 700, 2, 0x70) // Define two Vpins, feedback only sent to rotary encoder software
* HAL(RotaryEncoder, 700, 3, 0x67) // Define three Vpins, can send feedback and position update to rotary encoder software * HAL(RotaryEncoder, 700, 3, 0x70) // Define three Vpins, can send feedback and position update to rotary encoder software
* *
* Refer to the documentation for further information including the valid activities and examples. * Refer to the documentation for further information including the valid activities and examples.
*/ */

View File

@ -1,7 +1,7 @@
/* /*
* © 2022-2023 Paul M. Antoine * © 2022-2023 Paul M. Antoine
* © 2021 Fred Decker * © 2021 Fred Decker
* © 2020-2024 Harald Barth * © 2020-2023 Harald Barth
* (c) 2020 Chris Harlow. All rights reserved. * (c) 2020 Chris Harlow. All rights reserved.
* (c) 2021 Fred Decker. All rights reserved. * (c) 2021 Fred Decker. All rights reserved.
* (c) 2020 Harald Barth. All rights reserved. * (c) 2020 Harald Barth. All rights reserved.
@ -57,10 +57,6 @@
// of the brake pin on the motor bridge is inverted // of the brake pin on the motor bridge is inverted
// (HIGH == release brake) // (HIGH == release brake)
// You can have a CS wihout any possibility to do any track signal.
// That's strange but possible.
#define NO_SHIELD F("No shield at all")
// Arduino STANDARD Motor Shield, used on different architectures: // Arduino STANDARD Motor Shield, used on different architectures:
#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32) #if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_STM32)

View File

@ -1,6 +1,6 @@
/* /*
* © 2022 Chris Harlow * © 2022 Chris Harlow
* © 2022-2024 Harald Barth * © 2022,2023 Harald Barth
* © 2023 Colin Murdoch * © 2023 Colin Murdoch
* All rights reserved. * All rights reserved.
* *
@ -41,7 +41,7 @@
MotorDriver * TrackManager::track[MAX_TRACKS]; MotorDriver * TrackManager::track[MAX_TRACKS];
int16_t TrackManager::trackDCAddr[MAX_TRACKS]; int16_t TrackManager::trackDCAddr[MAX_TRACKS];
int8_t TrackManager::lastTrack=-1; byte TrackManager::lastTrack=0;
bool TrackManager::progTrackSyncMain=false; bool TrackManager::progTrackSyncMain=false;
bool TrackManager::progTrackBoosted=false; bool TrackManager::progTrackBoosted=false;
int16_t TrackManager::joinRelay=UNUSED_PIN; int16_t TrackManager::joinRelay=UNUSED_PIN;
@ -499,10 +499,6 @@ void TrackManager::setTrackPower(TRACK_MODE trackmodeToMatch, POWERMODE powermod
// Set track power for this track, inependent of mode // Set track power for this track, inependent of mode
void TrackManager::setTrackPower(POWERMODE powermode, byte t) { void TrackManager::setTrackPower(POWERMODE powermode, byte t) {
MotorDriver *driver=track[t]; MotorDriver *driver=track[t];
if (driver == NULL) { // track is not defined at all
DIAG(F("Error: Track %c does not exist"), t+'A');
return;
}
TRACK_MODE trackmode = driver->getMode(); TRACK_MODE trackmode = driver->getMode();
POWERMODE oldpower = driver->getPower(); POWERMODE oldpower = driver->getPower();
if (trackmode & TRACK_MODE_NONE) { if (trackmode & TRACK_MODE_NONE) {

View File

@ -1,6 +1,6 @@
/* /*
* © 2022 Chris Harlow * © 2022 Chris Harlow
* © 2022-2024 Harald Barth * © 2022 Harald Barth
* © 2023 Colin Murdoch * © 2023 Colin Murdoch
* *
* All rights reserved. * All rights reserved.
@ -46,7 +46,7 @@ const byte TRACK_POWER_1=1, TRACK_POWER_ON=1;
class TrackManager { class TrackManager {
public: public:
static void Setup(const FSH * shieldName, static void Setup(const FSH * shieldName,
MotorDriver * track0=NULL, MotorDriver * track0,
MotorDriver * track1=NULL, MotorDriver * track1=NULL,
MotorDriver * track2=NULL, MotorDriver * track2=NULL,
MotorDriver * track3=NULL, MotorDriver * track3=NULL,
@ -108,7 +108,7 @@ class TrackManager {
private: private:
static void addTrack(byte t, MotorDriver* driver); static void addTrack(byte t, MotorDriver* driver);
static int8_t lastTrack; static byte lastTrack;
static byte nextCycleTrack; static byte nextCycleTrack;
static void applyDCSpeed(byte t); static void applyDCSpeed(byte t);

View File

@ -571,7 +571,7 @@ void WiThrottle::sendRoutes(Print* stream) {
void WiThrottle::sendFunctions(Print* stream, byte loco) { void WiThrottle::sendFunctions(Print* stream, byte loco) {
int16_t locoid=myLocos[loco].cab; int16_t locoid=myLocos[loco].cab;
int fkeys=32; // upper limit (send functions 0 to 31) int fkeys=29;
myLocos[loco].functionToggles=1<<2; // F2 (HORN) is a non-toggle myLocos[loco].functionToggles=1<<2; // F2 (HORN) is a non-toggle
#ifdef EXRAIL_ACTIVE #ifdef EXRAIL_ACTIVE

View File

@ -351,13 +351,12 @@ void halSetup() {
//======================================================================= //=======================================================================
// The parameters are: // The parameters are:
// firstVpin = First available Vpin to allocate // firstVpin = First available Vpin to allocate
// numPins= Number of Vpins to allocate, can be either 1 to 3 // numPins= Number of Vpins to allocate, can be either 1 or 2
// i2cAddress = Available I2C address (default 0x67) // i2cAddress = Available I2C address (default 0x70)
//RotaryEncoder::create(firstVpin, numPins, i2cAddress); //RotaryEncoder::create(firstVpin, numPins, i2cAddress);
//RotaryEncoder::create(700, 1, 0x67); //RotaryEncoder::create(700, 1, 0x70);
//RotaryEncoder::create(700, 2, 0x67); //RotaryEncoder::create(701, 2, 0x71);
//RotaryEncoder::create(700, 3, 0x67);
//======================================================================= //=======================================================================
// The following directive defines an EX-FastClock instance. // The following directive defines an EX-FastClock instance.

View File

@ -3,10 +3,7 @@
#include "StringFormatter.h" #include "StringFormatter.h"
#define VERSION "5.3.7" #define VERSION "5.3.6"
// 5.2.41 - Update rotary encoder default address to 0x67
// 5.2.40 - Allow no shield
// 5.2.39 - Functions for DC frequency: Use func up to F31
// 5.2.38 - Exrail MESSAGE("text") to send a user message to all // 5.2.38 - Exrail MESSAGE("text") to send a user message to all
// connected throttles (uses <m "text"> and withrottle Hmtext. // connected throttles (uses <m "text"> and withrottle Hmtext.
// 5.2.37 - Bugfix ESP32: Use BOOSTER_INPUT define // 5.2.37 - Bugfix ESP32: Use BOOSTER_INPUT define