mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-07-29 02:13:45 +02:00
Compare commits
10 Commits
v5.4.4-Pro
...
master-boo
Author | SHA1 | Date | |
---|---|---|---|
|
c8ac10e893 | ||
|
1db0b8ab3e | ||
|
d9bd1e75f2 | ||
|
d1daf41f12 | ||
|
6bfa7028c4 | ||
|
a5d1d04882 | ||
|
bd6e426499 | ||
|
09bae44cc0 | ||
|
9f3354c687 | ||
|
fb495985f4 |
62
BoosterAutomation.h
Normal file
62
BoosterAutomation.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// Booster/CS switch automations
|
||||
// uses BOOSTER_INPUT from config.h
|
||||
// uses sequences BOOSTER_START, BOOSTER_CSMODE, BOOSTER_BOOSTERMODE, BOOSTER_CHANGELOGIC
|
||||
// uses latches 200
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#ifndef BOOSTER_INPUT
|
||||
#error You need to define BOOSTER_INPUT in config.h
|
||||
#endif
|
||||
ALIAS(BOOSTER_START)
|
||||
ALIAS(BOOSTER_CSMODE)
|
||||
ALIAS(BOOSTER_BOOSTERMODE)
|
||||
ALIAS(BOOSTER_CHANGELOGIC)
|
||||
AUTOSTART // remove this if you want manual start
|
||||
ROUTE(BOOSTER_START, "BOOSTER/CS auto START")
|
||||
PRINT("BOOTER/CS auto mode starting for both tracks")
|
||||
CALL(BOOSTER_BOOSTERMODE) // try booster mode
|
||||
FOLLOW(BOOSTER_CHANGELOGIC) // goto automatic mode
|
||||
|
||||
ROUTE(BOOSTER_CSMODE, "RUN AS CS")
|
||||
SET_TRACK(A, MAIN)
|
||||
// SET_POWER(A, ON)
|
||||
SET_TRACK(B, PROG)
|
||||
// SET_POWER(B, ON)
|
||||
PRINT("CS START")
|
||||
LATCH(200)
|
||||
RETURN
|
||||
|
||||
ROUTE(BOOSTER_BOOSTERMODE, "RUN AS BOOSTER")
|
||||
SET_TRACK(A, BOOST)
|
||||
SET_POWER(A, ON)
|
||||
SET_TRACK(B, BOOST)
|
||||
SET_POWER(B, ON)
|
||||
PRINT("BOOSTER START")
|
||||
UNLATCH(200)
|
||||
RETURN
|
||||
|
||||
#define BOOSTER_TIMEOUT 500
|
||||
SEQUENCE(BOOSTER_CHANGELOGIC)
|
||||
// Monitor pin change and get a timeout if not
|
||||
IF(BOOSTER_INPUT)
|
||||
ATTIMEOUT(-BOOSTER_INPUT,BOOSTER_TIMEOUT)
|
||||
ELSE
|
||||
ATTIMEOUT(BOOSTER_INPUT,BOOSTER_TIMEOUT)
|
||||
ENDIF
|
||||
IFTIMEOUT
|
||||
IF(200)
|
||||
// already switched to CS mode
|
||||
ELSE
|
||||
CALL(BOOSTER_CSMODE)
|
||||
ENDIF
|
||||
// hang here and wait for pin change
|
||||
IF(BOOSTER_INPUT)
|
||||
AT(-BOOSTER_INPUT)
|
||||
ELSE
|
||||
AT(BOOSTER_INPUT)
|
||||
ENDIF
|
||||
// pin change has happened, go to booster mode
|
||||
CALL(BOOSTER_BOOSTERMODE)
|
||||
ENDIF
|
||||
FOLLOW(BOOSTER_CHANGELOGIC)
|
||||
#undef BOOSTER_TIMEOUT
|
||||
#endif
|
@@ -280,6 +280,9 @@ void CommandDistributor::broadcastPower() {
|
||||
state = '1';
|
||||
}
|
||||
|
||||
if (state != '2')
|
||||
broadcastReply(COMMAND_TYPE, F("<p%c>\n"),state);
|
||||
|
||||
// additional info about MAIN, PROG and JOIN
|
||||
bool main=TrackManager::getMainPower()==POWERMODE::ON;
|
||||
bool prog=TrackManager::getProgPower()==POWERMODE::ON;
|
||||
@@ -288,7 +291,7 @@ void CommandDistributor::broadcastPower() {
|
||||
const FSH * reason=F("");
|
||||
if (join) {
|
||||
reason = F(" JOIN"); // with space at start so we can append without space
|
||||
broadcastReply(COMMAND_TYPE, F("<p1 %S>\n"),reason);
|
||||
broadcastReply(COMMAND_TYPE, F("<p1%S>\n"),reason);
|
||||
} else {
|
||||
if (main) {
|
||||
//reason = F("MAIN");
|
||||
@@ -299,9 +302,6 @@ void CommandDistributor::broadcastPower() {
|
||||
broadcastReply(COMMAND_TYPE, F("<p1 PROG>\n"));
|
||||
}
|
||||
}
|
||||
|
||||
if (state != '2')
|
||||
broadcastReply(COMMAND_TYPE, F("<p%c>\n"),state);
|
||||
#ifdef CD_HANDLE_RING
|
||||
// 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);
|
||||
|
@@ -78,11 +78,17 @@ int DCCTimer::freeMemory() {
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#if __has_include("esp_idf_version.h")
|
||||
#include "esp_idf_version.h"
|
||||
#if ESP_IDF_VERSION_MAJOR > 4
|
||||
#endif
|
||||
#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"
|
||||
#endif
|
||||
|
||||
// protect all the rest of the code from IDF version 5
|
||||
#if ESP_IDF_VERSION_MAJOR == 4
|
||||
#include "DIAG.h"
|
||||
#include <driver/adc.h>
|
||||
#include <soc/sens_reg.h>
|
||||
@@ -322,5 +328,5 @@ void ADCee::scan() {
|
||||
|
||||
void ADCee::begin() {
|
||||
}
|
||||
|
||||
#endif //IDF v4
|
||||
#endif //ESP32
|
||||
|
@@ -931,8 +931,9 @@ void RMFT2::loop2() {
|
||||
|
||||
#ifndef DISABLE_PROG
|
||||
case OPCODE_JOIN:
|
||||
TrackManager::setPower(POWERMODE::ON);
|
||||
TrackManager::setJoin(true);
|
||||
TrackManager::setMainPower(POWERMODE::ON);
|
||||
TrackManager::setProgPower(POWERMODE::ON);
|
||||
break;
|
||||
|
||||
case OPCODE_UNJOIN:
|
||||
|
BIN
Release_Notes/DCC-EX v5.4 Release Notes.xlsx
Normal file
BIN
Release_Notes/DCC-EX v5.4 Release Notes.xlsx
Normal file
Binary file not shown.
@@ -668,7 +668,8 @@ void TrackManager::setJoin(bool joined) {
|
||||
if (track[t]->getMode() & TRACK_MODE_PROG) { // find PROG track
|
||||
tempProgTrack = t; // remember PROG track
|
||||
setTrackMode(t, TRACK_MODE_MAIN);
|
||||
track[t]->setPower(POWERMODE::ON); // if joined, always on
|
||||
// setPower() of the track called after
|
||||
// seperately after setJoin() instead
|
||||
break; // there is only one prog track, done
|
||||
}
|
||||
}
|
||||
@@ -680,8 +681,6 @@ void TrackManager::setJoin(bool joined) {
|
||||
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
|
||||
|
@@ -500,9 +500,9 @@ void WiThrottle::getLocoCallback(int16_t locoid) {
|
||||
char addcmd[20]={'M',stashThrottleChar,'+', addrchar};
|
||||
itoa(locoid,addcmd+4,10);
|
||||
stashInstance->multithrottle(stashStream, (byte *)addcmd);
|
||||
TrackManager::setJoin(true); // <1 JOIN> so we can drive loco away
|
||||
TrackManager::setMainPower(POWERMODE::ON);
|
||||
TrackManager::setProgPower(POWERMODE::ON);
|
||||
TrackManager::setJoin(true); // <1 JOIN> so we can drive loco away
|
||||
DIAG(F("LocoCallback commit success"));
|
||||
stashStream->commit();
|
||||
}
|
||||
|
@@ -3,7 +3,9 @@
|
||||
|
||||
#include "StringFormatter.h"
|
||||
|
||||
#define VERSION "5.4.4"
|
||||
#define VERSION "5.4.5"
|
||||
// 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.3 - bugfix changeFn for functions 29..31
|
||||
// 5.4.2 - Reversed turnout bugfix
|
||||
|
Reference in New Issue
Block a user