mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-04-18 03:10:13 +02:00
Compare commits
No commits in common. "master" and "v5.4.4-Prod" have entirely different histories.
master
...
v5.4.4-Pro
@ -280,9 +280,6 @@ void CommandDistributor::broadcastPower() {
|
|||||||
state = '1';
|
state = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state != '2')
|
|
||||||
broadcastReply(COMMAND_TYPE, F("<p%c>\n"),state);
|
|
||||||
|
|
||||||
// additional info about MAIN, PROG and JOIN
|
// additional info about MAIN, PROG and JOIN
|
||||||
bool main=TrackManager::getMainPower()==POWERMODE::ON;
|
bool main=TrackManager::getMainPower()==POWERMODE::ON;
|
||||||
bool prog=TrackManager::getProgPower()==POWERMODE::ON;
|
bool prog=TrackManager::getProgPower()==POWERMODE::ON;
|
||||||
@ -302,6 +299,9 @@ void CommandDistributor::broadcastPower() {
|
|||||||
broadcastReply(COMMAND_TYPE, F("<p1 PROG>\n"));
|
broadcastReply(COMMAND_TYPE, F("<p1 PROG>\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state != '2')
|
||||||
|
broadcastReply(COMMAND_TYPE, F("<p%c>\n"),state);
|
||||||
#ifdef CD_HANDLE_RING
|
#ifdef CD_HANDLE_RING
|
||||||
// send '1' if all main are on, otherwise global state (which in that case is '0' or '2')
|
// send '1' if all main are on, otherwise global state (which in that case is '0' or '2')
|
||||||
broadcastReply(WITHROTTLE_TYPE, F("PPA%c\n"), main?'1': state);
|
broadcastReply(WITHROTTLE_TYPE, F("PPA%c\n"), main?'1': state);
|
||||||
|
31
DCC.cpp
31
DCC.cpp
@ -759,15 +759,7 @@ void DCC::issueReminders() {
|
|||||||
if (!DCCWaveform::mainTrack.isReminderWindowOpen()) return;
|
if (!DCCWaveform::mainTrack.isReminderWindowOpen()) return;
|
||||||
// Move to next loco slot. If occupied, send a reminder.
|
// Move to next loco slot. If occupied, send a reminder.
|
||||||
int reg = lastLocoReminder+1;
|
int reg = lastLocoReminder+1;
|
||||||
if (reg > highestUsedReg) {
|
if (reg > highestUsedReg) reg = 0; // Go to start of table
|
||||||
if (loopStatus == 0 /*only needed if numLocos == 1 but we do not have a counter*/) {
|
|
||||||
// insert idle packet in the speed packet loop to fullfill the *censored*
|
|
||||||
// >5ms between packets to same decoder rule
|
|
||||||
const byte idlepacket[] = {0xFF, 0x00, 0xFF};
|
|
||||||
DCCWaveform::mainTrack.schedulePacket(idlepacket, 3, 0);
|
|
||||||
}
|
|
||||||
reg = 0; // Go to start of table
|
|
||||||
}
|
|
||||||
if (speedTable[reg].loco > 0) {
|
if (speedTable[reg].loco > 0) {
|
||||||
// have found loco to remind
|
// have found loco to remind
|
||||||
if (issueReminder(reg))
|
if (issueReminder(reg))
|
||||||
@ -788,23 +780,40 @@ bool DCC::issueReminder(int reg) {
|
|||||||
break;
|
break;
|
||||||
case 1: // remind function group 1 (F0-F4)
|
case 1: // remind function group 1 (F0-F4)
|
||||||
if (flags & FN_GROUP_1)
|
if (flags & FN_GROUP_1)
|
||||||
|
#ifndef DISABLE_FUNCTION_REMINDERS
|
||||||
setFunctionInternal(loco,0, 128 | ((functions>>1)& 0x0F) | ((functions & 0x01)<<4),0); // 100D DDDD
|
setFunctionInternal(loco,0, 128 | ((functions>>1)& 0x0F) | ((functions & 0x01)<<4),0); // 100D DDDD
|
||||||
|
#else
|
||||||
|
setFunctionInternal(loco,0, 128 | ((functions>>1)& 0x0F) | ((functions & 0x01)<<4),2);
|
||||||
|
flags&= ~FN_GROUP_1; // dont send them again
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 2: // remind function group 2 F5-F8
|
case 2: // remind function group 2 F5-F8
|
||||||
if (flags & FN_GROUP_2)
|
if (flags & FN_GROUP_2)
|
||||||
|
#ifndef DISABLE_FUNCTION_REMINDERS
|
||||||
setFunctionInternal(loco,0, 176 | ((functions>>5)& 0x0F),0); // 1011 DDDD
|
setFunctionInternal(loco,0, 176 | ((functions>>5)& 0x0F),0); // 1011 DDDD
|
||||||
|
#else
|
||||||
|
setFunctionInternal(loco,0, 176 | ((functions>>5)& 0x0F),2);
|
||||||
|
flags&= ~FN_GROUP_2; // dont send them again
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3: // remind function group 3 F9-F12
|
case 3: // remind function group 3 F9-F12
|
||||||
if (flags & FN_GROUP_3)
|
if (flags & FN_GROUP_3)
|
||||||
|
#ifndef DISABLE_FUNCTION_REMINDERS
|
||||||
setFunctionInternal(loco,0, 160 | ((functions>>9)& 0x0F),0); // 1010 DDDD
|
setFunctionInternal(loco,0, 160 | ((functions>>9)& 0x0F),0); // 1010 DDDD
|
||||||
|
#else
|
||||||
|
setFunctionInternal(loco,0, 160 | ((functions>>9)& 0x0F),2);
|
||||||
|
flags&= ~FN_GROUP_3; // dont send them again
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 4: // remind function group 4 F13-F20
|
case 4: // remind function group 4 F13-F20
|
||||||
if (flags & FN_GROUP_4)
|
if (flags & FN_GROUP_4)
|
||||||
setFunctionInternal(loco,222, ((functions>>13)& 0xFF),0);
|
setFunctionInternal(loco,222, ((functions>>13)& 0xFF),2);
|
||||||
|
flags&= ~FN_GROUP_4; // dont send them again
|
||||||
break;
|
break;
|
||||||
case 5: // remind function group 5 F21-F28
|
case 5: // remind function group 5 F21-F28
|
||||||
if (flags & FN_GROUP_5)
|
if (flags & FN_GROUP_5)
|
||||||
setFunctionInternal(loco,223, ((functions>>21)& 0xFF),0);
|
setFunctionInternal(loco,223, ((functions>>21)& 0xFF),2);
|
||||||
|
flags&= ~FN_GROUP_5; // dont send them again
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
loopStatus++;
|
loopStatus++;
|
||||||
|
@ -270,20 +270,16 @@ void DCCEXParser::parse(Print *stream, byte *com, RingStream *ringStream) {
|
|||||||
// This function can get stings of the form "<C OMM AND>" or "C OMM AND>"
|
// This function can get stings of the form "<C OMM AND>" or "C OMM AND>"
|
||||||
// found is true first after the leading "<" has been passed which results
|
// found is true first after the leading "<" has been passed which results
|
||||||
// in parseOne() getting c="C OMM AND>"
|
// in parseOne() getting c="C OMM AND>"
|
||||||
byte *cForLater = NULL;
|
|
||||||
bool found = (com[0] != '<');
|
bool found = (com[0] != '<');
|
||||||
for (byte *c=com; c[0] != '\0'; c++) {
|
for (byte *c=com; c[0] != '\0'; c++) {
|
||||||
if (found) {
|
if (found) {
|
||||||
cForLater = c;
|
parseOne(stream, c, ringStream);
|
||||||
found=false;
|
found=false;
|
||||||
}
|
}
|
||||||
if (c[0] == '<') {
|
if (c[0] == '<')
|
||||||
if (cForLater) parseOne(stream, cForLater, ringStream);
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cForLater) parseOne(stream, cForLater, ringStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
{
|
{
|
||||||
|
@ -78,17 +78,11 @@ int DCCTimer::freeMemory() {
|
|||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
|
||||||
#if __has_include("esp_idf_version.h")
|
|
||||||
#include "esp_idf_version.h"
|
#include "esp_idf_version.h"
|
||||||
#endif
|
#if ESP_IDF_VERSION_MAJOR > 4
|
||||||
#if ESP_IDF_VERSION_MAJOR == 4
|
|
||||||
// all well correct IDF version
|
|
||||||
#else
|
|
||||||
#error "DCC-EX does not support compiling with IDF version 5.0 or later. Downgrade your ESP32 library to a version that contains IDF version 4. Arduino ESP32 library 3.0.0 is too new. Downgrade to one of 2.0.9 to 2.0.17"
|
#error "DCC-EX does not support compiling with IDF version 5.0 or later. Downgrade your ESP32 library to a version that contains IDF version 4. Arduino ESP32 library 3.0.0 is too new. Downgrade to one of 2.0.9 to 2.0.17"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// protect all the rest of the code from IDF version 5
|
|
||||||
#if ESP_IDF_VERSION_MAJOR == 4
|
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include <driver/adc.h>
|
#include <driver/adc.h>
|
||||||
#include <soc/sens_reg.h>
|
#include <soc/sens_reg.h>
|
||||||
@ -328,5 +322,5 @@ void ADCee::scan() {
|
|||||||
|
|
||||||
void ADCee::begin() {
|
void ADCee::begin() {
|
||||||
}
|
}
|
||||||
#endif //IDF v4
|
|
||||||
#endif //ESP32
|
#endif //ESP32
|
||||||
|
@ -931,9 +931,8 @@ void RMFT2::loop2() {
|
|||||||
|
|
||||||
#ifndef DISABLE_PROG
|
#ifndef DISABLE_PROG
|
||||||
case OPCODE_JOIN:
|
case OPCODE_JOIN:
|
||||||
|
TrackManager::setPower(POWERMODE::ON);
|
||||||
TrackManager::setJoin(true);
|
TrackManager::setJoin(true);
|
||||||
TrackManager::setMainPower(POWERMODE::ON);
|
|
||||||
TrackManager::setProgPower(POWERMODE::ON);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_UNJOIN:
|
case OPCODE_UNJOIN:
|
||||||
|
@ -217,7 +217,7 @@
|
|||||||
#define BROADCAST(msg)
|
#define BROADCAST(msg)
|
||||||
#define CALL(route)
|
#define CALL(route)
|
||||||
#define CLEAR_STASH(id)
|
#define CLEAR_STASH(id)
|
||||||
#define CLEAR_ALL_STASH
|
#define CLEAR_ALL_STASH(id)
|
||||||
#define CLOSE(id)
|
#define CLOSE(id)
|
||||||
#define CONFIGURE_SERVO(vpin,pos1,pos2,profile)
|
#define CONFIGURE_SERVO(vpin,pos1,pos2,profile)
|
||||||
#define DCC_SIGNAL(id,add,subaddr)
|
#define DCC_SIGNAL(id,add,subaddr)
|
||||||
|
Binary file not shown.
@ -668,8 +668,7 @@ void TrackManager::setJoin(bool joined) {
|
|||||||
if (track[t]->getMode() & TRACK_MODE_PROG) { // find PROG track
|
if (track[t]->getMode() & TRACK_MODE_PROG) { // find PROG track
|
||||||
tempProgTrack = t; // remember PROG track
|
tempProgTrack = t; // remember PROG track
|
||||||
setTrackMode(t, TRACK_MODE_MAIN);
|
setTrackMode(t, TRACK_MODE_MAIN);
|
||||||
// setPower() of the track called after
|
track[t]->setPower(POWERMODE::ON); // if joined, always on
|
||||||
// seperately after setJoin() instead
|
|
||||||
break; // there is only one prog track, done
|
break; // there is only one prog track, done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -681,6 +680,8 @@ void TrackManager::setJoin(bool joined) {
|
|||||||
setTrackMode(tempProgTrack, TRACK_MODE_PROG); // set track mode back to prog
|
setTrackMode(tempProgTrack, TRACK_MODE_PROG); // set track mode back to prog
|
||||||
track[tempProgTrack]->setPower(tPTmode); // set power status as it was before
|
track[tempProgTrack]->setPower(tPTmode); // set power status as it was before
|
||||||
tempProgTrack = MAX_TRACKS+1;
|
tempProgTrack = MAX_TRACKS+1;
|
||||||
|
} else {
|
||||||
|
DIAG(F("Unjoin but no remembered prog track"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,9 +500,9 @@ void WiThrottle::getLocoCallback(int16_t locoid) {
|
|||||||
char addcmd[20]={'M',stashThrottleChar,'+', addrchar};
|
char addcmd[20]={'M',stashThrottleChar,'+', addrchar};
|
||||||
itoa(locoid,addcmd+4,10);
|
itoa(locoid,addcmd+4,10);
|
||||||
stashInstance->multithrottle(stashStream, (byte *)addcmd);
|
stashInstance->multithrottle(stashStream, (byte *)addcmd);
|
||||||
TrackManager::setJoin(true); // <1 JOIN> so we can drive loco away
|
|
||||||
TrackManager::setMainPower(POWERMODE::ON);
|
TrackManager::setMainPower(POWERMODE::ON);
|
||||||
TrackManager::setProgPower(POWERMODE::ON);
|
TrackManager::setProgPower(POWERMODE::ON);
|
||||||
|
TrackManager::setJoin(true); // <1 JOIN> so we can drive loco away
|
||||||
DIAG(F("LocoCallback commit success"));
|
DIAG(F("LocoCallback commit success"));
|
||||||
stashStream->commit();
|
stashStream->commit();
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,7 @@
|
|||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.4.8"
|
#define VERSION "5.4.4"
|
||||||
// 5.4.8 - Bugfix: Insert idle packet at end of speed reminder loop; treat all function groups equal
|
|
||||||
// 5.4.7 - Bugfix: EXRAIL fix CLEAR_ALL_STASH
|
|
||||||
// 5.4.6 - Bugfix: Do not drop further commands in same packet
|
|
||||||
// 5.4.5 - ESP32: Better detection of correct IDF version
|
|
||||||
// - track power is always turned on after setJoin() not by setJoin()
|
|
||||||
// 5.4.4 - bugfix in parser, input buffer overrun and trailing > that did break <+>
|
// 5.4.4 - bugfix in parser, input buffer overrun and trailing > that did break <+>
|
||||||
// 5.4.3 - bugfix changeFn for functions 29..31
|
// 5.4.3 - bugfix changeFn for functions 29..31
|
||||||
// 5.4.2 - Reversed turnout bugfix
|
// 5.4.2 - Reversed turnout bugfix
|
||||||
|
Loading…
Reference in New Issue
Block a user