mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
Compare commits
12 Commits
9de6638085
...
36588fe202
Author | SHA1 | Date | |
---|---|---|---|
|
36588fe202 | ||
|
a8b4e39733 | ||
|
d705626f4a | ||
|
c97284c15f | ||
|
df1f365c1e | ||
|
023c004842 | ||
|
2481f1c5d6 | ||
|
7dadecb5df | ||
|
6ef312b510 | ||
|
97f9fb4813 | ||
|
3d6c935308 | ||
|
fba9a30813 |
14
DCC.cpp
14
DCC.cpp
|
@ -271,6 +271,20 @@ uint32_t DCC::getFunctionMap(int cab) {
|
||||||
return (reg<0)?0:speedTable[reg].functions;
|
return (reg<0)?0:speedTable[reg].functions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// saves DC frequency (0..3) in spare functions 29,30,31
|
||||||
|
void DCC::setDCFreq(int cab,byte freq) {
|
||||||
|
if (cab==0 || freq>3) return;
|
||||||
|
auto reg=lookupSpeedTable(cab,true);
|
||||||
|
// drop and replace F29,30,31 (top 3 bits)
|
||||||
|
auto newFunctions=speedTable[reg].functions & 0x1FFFFFFFUL;
|
||||||
|
if (freq==1) newFunctions |= (1UL<<29); // F29
|
||||||
|
else if (freq==2) newFunctions |= (1UL<<30); // F30
|
||||||
|
else if (freq==3) newFunctions |= (1UL<<31); // F31
|
||||||
|
if (newFunctions==speedTable[reg].functions) return; // no change
|
||||||
|
speedTable[reg].functions=newFunctions;
|
||||||
|
CommandDistributor::broadcastLoco(reg);
|
||||||
|
}
|
||||||
|
|
||||||
void DCC::setAccessory(int address, byte port, bool gate, byte onoff /*= 2*/) {
|
void DCC::setAccessory(int address, byte port, bool gate, byte onoff /*= 2*/) {
|
||||||
// onoff is tristate:
|
// onoff is tristate:
|
||||||
// 0 => send off packet
|
// 0 => send off packet
|
||||||
|
|
1
DCC.h
1
DCC.h
|
@ -70,6 +70,7 @@ public:
|
||||||
static void changeFn(int cab, int16_t functionNumber);
|
static void changeFn(int cab, int16_t functionNumber);
|
||||||
static int8_t getFn(int cab, int16_t functionNumber);
|
static int8_t getFn(int cab, int16_t functionNumber);
|
||||||
static uint32_t getFunctionMap(int cab);
|
static uint32_t getFunctionMap(int cab);
|
||||||
|
static void setDCFreq(int cab,byte freq);
|
||||||
static void updateGroupflags(byte &flags, int16_t functionNumber);
|
static void updateGroupflags(byte &flags, int16_t functionNumber);
|
||||||
static void setAccessory(int address, byte port, bool gate, byte onoff = 2);
|
static void setAccessory(int address, byte port, bool gate, byte onoff = 2);
|
||||||
static bool setExtendedAccessory(int16_t address, int16_t value, byte repeats=3);
|
static bool setExtendedAccessory(int16_t address, int16_t value, byte repeats=3);
|
||||||
|
|
10
DCCACK.cpp
10
DCCACK.cpp
|
@ -27,8 +27,8 @@
|
||||||
#include "DCCWaveform.h"
|
#include "DCCWaveform.h"
|
||||||
#include "TrackManager.h"
|
#include "TrackManager.h"
|
||||||
|
|
||||||
unsigned int DCCACK::minAckPulseDuration = 2000; // micros
|
unsigned long DCCACK::minAckPulseDuration = 2000; // micros
|
||||||
unsigned int DCCACK::maxAckPulseDuration = 20000; // micros
|
unsigned long DCCACK::maxAckPulseDuration = 20000; // micros
|
||||||
|
|
||||||
MotorDriver * DCCACK::progDriver=NULL;
|
MotorDriver * DCCACK::progDriver=NULL;
|
||||||
ackOp const * DCCACK::ackManagerProg;
|
ackOp const * DCCACK::ackManagerProg;
|
||||||
|
@ -50,7 +50,7 @@ volatile uint8_t DCCACK::numAckSamples=0;
|
||||||
uint8_t DCCACK::trailingEdgeCounter=0;
|
uint8_t DCCACK::trailingEdgeCounter=0;
|
||||||
|
|
||||||
|
|
||||||
unsigned int DCCACK::ackPulseDuration; // micros
|
unsigned long DCCACK::ackPulseDuration; // micros
|
||||||
unsigned long DCCACK::ackPulseStart; // micros
|
unsigned long DCCACK::ackPulseStart; // micros
|
||||||
volatile bool DCCACK::ackDetected;
|
volatile bool DCCACK::ackDetected;
|
||||||
unsigned long DCCACK::ackCheckStart; // millis
|
unsigned long DCCACK::ackCheckStart; // millis
|
||||||
|
@ -127,7 +127,7 @@ bool DCCACK::checkResets(uint8_t numResets) {
|
||||||
void DCCACK::setAckBaseline() {
|
void DCCACK::setAckBaseline() {
|
||||||
int baseline=progDriver->getCurrentRaw();
|
int baseline=progDriver->getCurrentRaw();
|
||||||
ackThreshold= baseline + progDriver->mA2raw(ackLimitmA);
|
ackThreshold= baseline + progDriver->mA2raw(ackLimitmA);
|
||||||
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %uus and %uus"),
|
if (Diag::ACK) DIAG(F("ACK baseline=%d/%dmA Threshold=%d/%dmA Duration between %lus and %lus"),
|
||||||
baseline,progDriver->raw2mA(baseline),
|
baseline,progDriver->raw2mA(baseline),
|
||||||
ackThreshold,progDriver->raw2mA(ackThreshold),
|
ackThreshold,progDriver->raw2mA(ackThreshold),
|
||||||
minAckPulseDuration, maxAckPulseDuration);
|
minAckPulseDuration, maxAckPulseDuration);
|
||||||
|
@ -146,7 +146,7 @@ void DCCACK::setAckPending() {
|
||||||
|
|
||||||
byte DCCACK::getAck() {
|
byte DCCACK::getAck() {
|
||||||
if (ackPending) return (2); // still waiting
|
if (ackPending) return (2); // still waiting
|
||||||
if (Diag::ACK) DIAG(F("%S after %dmS max=%d/%dmA pulse=%uuS samples=%d gaps=%d"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
|
if (Diag::ACK) DIAG(F("%S after %dmS max=%d/%dmA pulse=%luS samples=%d gaps=%d"),ackDetected?F("ACK"):F("NO-ACK"), ackCheckDuration,
|
||||||
ackMaxCurrent,progDriver->raw2mA(ackMaxCurrent), ackPulseDuration, numAckSamples, numAckGaps);
|
ackMaxCurrent,progDriver->raw2mA(ackMaxCurrent), ackPulseDuration, numAckSamples, numAckGaps);
|
||||||
if (ackDetected) return (1); // Yes we had an ack
|
if (ackDetected) return (1); // Yes we had an ack
|
||||||
return(0); // pending set off but not detected means no ACK.
|
return(0); // pending set off but not detected means no ACK.
|
||||||
|
|
10
DCCACK.h
10
DCCACK.h
|
@ -79,10 +79,10 @@ class DCCACK {
|
||||||
static inline void setAckLimit(int mA) {
|
static inline void setAckLimit(int mA) {
|
||||||
ackLimitmA = mA;
|
ackLimitmA = mA;
|
||||||
}
|
}
|
||||||
static inline void setMinAckPulseDuration(unsigned int i) {
|
static inline void setMinAckPulseDuration(unsigned long i) {
|
||||||
minAckPulseDuration = i;
|
minAckPulseDuration = i;
|
||||||
}
|
}
|
||||||
static inline void setMaxAckPulseDuration(unsigned int i) {
|
static inline void setMaxAckPulseDuration(unsigned long i) {
|
||||||
maxAckPulseDuration = i;
|
maxAckPulseDuration = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,11 +126,11 @@ class DCCACK {
|
||||||
static unsigned long ackCheckStart; // millis
|
static unsigned long ackCheckStart; // millis
|
||||||
static unsigned int ackCheckDuration; // millis
|
static unsigned int ackCheckDuration; // millis
|
||||||
|
|
||||||
static unsigned int ackPulseDuration; // micros
|
static unsigned long ackPulseDuration; // micros
|
||||||
static unsigned long ackPulseStart; // micros
|
static unsigned long ackPulseStart; // micros
|
||||||
|
|
||||||
static unsigned int minAckPulseDuration ; // micros
|
static unsigned long minAckPulseDuration ; // micros
|
||||||
static unsigned int maxAckPulseDuration ; // micros
|
static unsigned long maxAckPulseDuration ; // micros
|
||||||
static MotorDriver* progDriver;
|
static MotorDriver* progDriver;
|
||||||
static volatile uint8_t numAckGaps;
|
static volatile uint8_t numAckGaps;
|
||||||
static volatile uint8_t numAckSamples;
|
static volatile uint8_t numAckSamples;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* © 2022 Paul M Antoine
|
* © 2022 Paul M Antoine
|
||||||
* © 2021 Neil McKechnie
|
* © 2021 Neil McKechnie
|
||||||
* © 2021 Mike S
|
* © 2021 Mike S
|
||||||
* © 2021 Herb Morton
|
* © 2021-2024 Herb Morton
|
||||||
* © 2020-2023 Harald Barth
|
* © 2020-2023 Harald Barth
|
||||||
* © 2020-2021 M Steve Todd
|
* © 2020-2021 M Steve Todd
|
||||||
* © 2020-2021 Fred Decker
|
* © 2020-2021 Fred Decker
|
||||||
|
@ -563,6 +563,7 @@ void DCCEXParser::parseOne(Print *stream, byte *com, RingStream * ringStream)
|
||||||
}
|
}
|
||||||
#ifndef DISABLE_PROG
|
#ifndef DISABLE_PROG
|
||||||
else if (p[0]=="PROG"_hk) { // <0 PROG>
|
else if (p[0]=="PROG"_hk) { // <0 PROG>
|
||||||
|
TrackManager::setJoin(false);
|
||||||
TrackManager::progTrackBoosted=false; // Prog track boost mode will not outlive prog track off
|
TrackManager::progTrackBoosted=false; // Prog track boost mode will not outlive prog track off
|
||||||
TrackManager::setTrackPower(TRACK_MODE_PROG, POWERMODE::OFF);
|
TrackManager::setTrackPower(TRACK_MODE_PROG, POWERMODE::OFF);
|
||||||
}
|
}
|
||||||
|
@ -1073,15 +1074,24 @@ bool DCCEXParser::parseC(Print *stream, int16_t params, int16_t p[]) {
|
||||||
#ifndef DISABLE_PROG
|
#ifndef DISABLE_PROG
|
||||||
case "ACK"_hk: // <D ACK ON/OFF> <D ACK [LIMIT|MIN|MAX|RETRY] Value>
|
case "ACK"_hk: // <D ACK ON/OFF> <D ACK [LIMIT|MIN|MAX|RETRY] Value>
|
||||||
if (params >= 3) {
|
if (params >= 3) {
|
||||||
|
long duration;
|
||||||
if (p[1] == "LIMIT"_hk) {
|
if (p[1] == "LIMIT"_hk) {
|
||||||
DCCACK::setAckLimit(p[2]);
|
DCCACK::setAckLimit(p[2]);
|
||||||
LCD(1, F("Ack Limit=%dmA"), p[2]); // <D ACK LIMIT 42>
|
LCD(1, F("Ack Limit=%dmA"), p[2]); // <D ACK LIMIT 42>
|
||||||
} else if (p[1] == "MIN"_hk) {
|
} else if (p[1] == "MIN"_hk) {
|
||||||
DCCACK::setMinAckPulseDuration(p[2]);
|
if (params == 4 && p[3] == "MS"_hk)
|
||||||
LCD(0, F("Ack Min=%uus"), p[2]); // <D ACK MIN 1500>
|
duration = p[2] * 1000L;
|
||||||
|
else
|
||||||
|
duration = p[2];
|
||||||
|
DCCACK::setMinAckPulseDuration(duration);
|
||||||
|
LCD(0, F("Ack Min=%lus"), duration); // <D ACK MIN 1500>
|
||||||
} else if (p[1] == "MAX"_hk) {
|
} else if (p[1] == "MAX"_hk) {
|
||||||
DCCACK::setMaxAckPulseDuration(p[2]);
|
if (params == 4 && p[3] == "MS"_hk) // <D ACK MAX 80 MS>
|
||||||
LCD(0, F("Ack Max=%uus"), p[2]); // <D ACK MAX 9000>
|
duration = p[2] * 1000L;
|
||||||
|
else
|
||||||
|
duration = p[2];
|
||||||
|
DCCACK::setMaxAckPulseDuration(duration);
|
||||||
|
LCD(0, F("Ack Max=%lus"), duration); // <D ACK MAX 9000>
|
||||||
} else if (p[1] == "RETRY"_hk) {
|
} else if (p[1] == "RETRY"_hk) {
|
||||||
if (p[2] >255) p[2]=3;
|
if (p[2] >255) p[2]=3;
|
||||||
LCD(0, F("Ack Retry=%d Sum=%d"), p[2], DCCACK::setAckRetry(p[2])); // <D ACK RETRY 2>
|
LCD(0, F("Ack Retry=%d Sum=%d"), p[2], DCCACK::setAckRetry(p[2])); // <D ACK RETRY 2>
|
||||||
|
|
|
@ -297,7 +297,12 @@ void DCCTimer::DCCEXInrushControlOn(uint8_t pin, int duty, bool inverted) {
|
||||||
int ADCee::init(uint8_t pin) {
|
int ADCee::init(uint8_t pin) {
|
||||||
pinMode(pin, ANALOG);
|
pinMode(pin, ANALOG);
|
||||||
adc1_config_width(ADC_WIDTH_BIT_12);
|
adc1_config_width(ADC_WIDTH_BIT_12);
|
||||||
|
// Espressif deprecated ADC_ATTEN_DB_11 somewhere between 2.0.9 and 2.0.17
|
||||||
|
#ifdef ADC_ATTEN_11db
|
||||||
|
adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_11db);
|
||||||
|
#else
|
||||||
adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_DB_11);
|
adc1_config_channel_atten(pinToADC1Channel(pin),ADC_ATTEN_DB_11);
|
||||||
|
#endif
|
||||||
return adc1_get_raw(pinToADC1Channel(pin));
|
return adc1_get_raw(pinToADC1Channel(pin));
|
||||||
}
|
}
|
||||||
int16_t ADCee::ADCmax() {
|
int16_t ADCee::ADCmax() {
|
||||||
|
|
46
EXRAIL2.cpp
46
EXRAIL2.cpp
|
@ -716,41 +716,7 @@ void RMFT2::loop2() {
|
||||||
|
|
||||||
case OPCODE_SETFREQ:
|
case OPCODE_SETFREQ:
|
||||||
// Frequency is default 0, or 1, 2,3
|
// Frequency is default 0, or 1, 2,3
|
||||||
//if (loco) DCC::setFn(loco,operand,true);
|
DCC::setDCFreq(loco,operand);
|
||||||
switch (operand) {
|
|
||||||
case 0: // default - all F-s off
|
|
||||||
if (loco) {
|
|
||||||
DCC::setFn(loco,29,false);
|
|
||||||
DCC::setFn(loco,30,false);
|
|
||||||
DCC::setFn(loco,31,false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (loco) {
|
|
||||||
DCC::setFn(loco,29,true);
|
|
||||||
DCC::setFn(loco,30,false);
|
|
||||||
DCC::setFn(loco,31,false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
if (loco) {
|
|
||||||
DCC::setFn(loco,29,false);
|
|
||||||
DCC::setFn(loco,30,true);
|
|
||||||
DCC::setFn(loco,31,false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
if (loco) {
|
|
||||||
DCC::setFn(loco,29,false);
|
|
||||||
DCC::setFn(loco,30,false);
|
|
||||||
DCC::setFn(loco,31,true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
; // do nothing
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPCODE_RESUME:
|
case OPCODE_RESUME:
|
||||||
|
@ -1001,6 +967,14 @@ void RMFT2::loop2() {
|
||||||
StringFormatter::send(LCCSerial,F("<L x%h>"),(uint16_t)operand);
|
StringFormatter::send(LCCSerial,F("<L x%h>"),(uint16_t)operand);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPCODE_ACON: // MERG adapter
|
||||||
|
case OPCODE_ACOF:
|
||||||
|
if ((compileFeatures & FEATURE_LCC) && LCCSerial)
|
||||||
|
StringFormatter::send(LCCSerial,F("<L x%c%h%h>"),
|
||||||
|
opcode==OPCODE_ACON?'0':'1',
|
||||||
|
(uint16_t)operand,getOperand(progCounter,1));
|
||||||
|
break;
|
||||||
|
|
||||||
case OPCODE_LCCX: // long form LCC
|
case OPCODE_LCCX: // long form LCC
|
||||||
if ((compileFeatures & FEATURE_LCC) && LCCSerial)
|
if ((compileFeatures & FEATURE_LCC) && LCCSerial)
|
||||||
StringFormatter::send(LCCSerial,F("<L x%h%h%h%h>\n"),
|
StringFormatter::send(LCCSerial,F("<L x%h%h%h%h>\n"),
|
||||||
|
@ -1088,6 +1062,8 @@ void RMFT2::loop2() {
|
||||||
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
case OPCODE_PINTURNOUT: // Turnout definition ignored at runtime
|
||||||
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
case OPCODE_ONCLOSE: // Turnout event catchers ignored here
|
||||||
case OPCODE_ONLCC: // LCC event catchers ignored here
|
case OPCODE_ONLCC: // LCC event catchers ignored here
|
||||||
|
case OPCODE_ONACON: // MERG event catchers ignored here
|
||||||
|
case OPCODE_ONACOF: // MERG event catchers ignored here
|
||||||
case OPCODE_ONTHROW:
|
case OPCODE_ONTHROW:
|
||||||
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
case OPCODE_ONACTIVATE: // Activate event catchers ignored here
|
||||||
case OPCODE_ONDEACTIVATE:
|
case OPCODE_ONDEACTIVATE:
|
||||||
|
|
|
@ -69,6 +69,8 @@ enum OPCODE : byte {OPCODE_THROW,OPCODE_CLOSE,OPCODE_TOGGLE_TURNOUT,
|
||||||
OPCODE_TTADDPOSITION,OPCODE_DCCTURNTABLE,OPCODE_EXTTTURNTABLE,
|
OPCODE_TTADDPOSITION,OPCODE_DCCTURNTABLE,OPCODE_EXTTTURNTABLE,
|
||||||
OPCODE_ONROTATE,OPCODE_ROTATE,OPCODE_WAITFORTT,
|
OPCODE_ONROTATE,OPCODE_ROTATE,OPCODE_WAITFORTT,
|
||||||
OPCODE_LCC,OPCODE_LCCX,OPCODE_ONLCC,
|
OPCODE_LCC,OPCODE_LCCX,OPCODE_ONLCC,
|
||||||
|
OPCODE_ACON, OPCODE_ACOF,
|
||||||
|
OPCODE_ONACON, OPCODE_ONACOF,
|
||||||
OPCODE_ONOVERLOAD,
|
OPCODE_ONOVERLOAD,
|
||||||
OPCODE_ROUTE_ACTIVE,OPCODE_ROUTE_INACTIVE,OPCODE_ROUTE_HIDDEN,
|
OPCODE_ROUTE_ACTIVE,OPCODE_ROUTE_INACTIVE,OPCODE_ROUTE_HIDDEN,
|
||||||
OPCODE_ROUTE_DISABLED,
|
OPCODE_ROUTE_DISABLED,
|
||||||
|
|
|
@ -99,6 +99,10 @@
|
||||||
#undef LCCX
|
#undef LCCX
|
||||||
#undef LCN
|
#undef LCN
|
||||||
#undef MOVETT
|
#undef MOVETT
|
||||||
|
#undef ACON
|
||||||
|
#undef ACOF
|
||||||
|
#undef ONACON
|
||||||
|
#undef ONACOF
|
||||||
#undef MESSAGE
|
#undef MESSAGE
|
||||||
#undef ONACTIVATE
|
#undef ONACTIVATE
|
||||||
#undef ONACTIVATEL
|
#undef ONACTIVATEL
|
||||||
|
@ -265,6 +269,10 @@
|
||||||
#define LCN(msg)
|
#define LCN(msg)
|
||||||
#define MESSAGE(msg)
|
#define MESSAGE(msg)
|
||||||
#define MOVETT(id,steps,activity)
|
#define MOVETT(id,steps,activity)
|
||||||
|
#define ACON(eventid)
|
||||||
|
#define ACOF(eventid)
|
||||||
|
#define ONACON(eventid)
|
||||||
|
#define ONACOF(eventid)
|
||||||
#define ONACTIVATE(addr,subaddr)
|
#define ONACTIVATE(addr,subaddr)
|
||||||
#define ONACTIVATEL(linear)
|
#define ONACTIVATEL(linear)
|
||||||
#define ONAMBER(signal_id)
|
#define ONAMBER(signal_id)
|
||||||
|
|
|
@ -61,48 +61,86 @@ void RMFT2::ComandFilter(Print * stream, byte & opcode, byte & paramCount, int16
|
||||||
case 'L':
|
case 'L':
|
||||||
// This entire code block is compiled out if LLC macros not used
|
// This entire code block is compiled out if LLC macros not used
|
||||||
if (!(compileFeatures & FEATURE_LCC)) return;
|
if (!(compileFeatures & FEATURE_LCC)) return;
|
||||||
|
static int lccProgCounter=0;
|
||||||
|
static int lccEventIndex=0;
|
||||||
|
|
||||||
if (paramCount==0) { //<L> LCC adapter introducing self
|
if (paramCount==0) { //<L> LCC adapter introducing self
|
||||||
LCCSerial=stream; // now we know where to send events we raise
|
LCCSerial=stream; // now we know where to send events we raise
|
||||||
|
opcode=0; // flag command as intercepted
|
||||||
|
|
||||||
// loop through all possible sent events
|
// loop through all possible sent/waited events
|
||||||
for (int progCounter=0;; SKIPOP) {
|
for (int progCounter=lccProgCounter;; SKIPOP) {
|
||||||
byte opcode=GET_OPCODE;
|
byte exrailOpcode=GET_OPCODE;
|
||||||
if (opcode==OPCODE_ENDEXRAIL) break;
|
switch (exrailOpcode) {
|
||||||
if (opcode==OPCODE_LCC) StringFormatter::send(stream,F("<LS x%h>\n"),getOperand(progCounter,0));
|
case OPCODE_ENDEXRAIL:
|
||||||
if (opcode==OPCODE_LCCX) { // long form LCC
|
stream->print(F("<LR>\n")); // ready to roll
|
||||||
|
lccProgCounter=0; // allow a second pass
|
||||||
|
lccEventIndex=0;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_LCC:
|
||||||
|
StringFormatter::send(stream,F("<LS x%h>\n"),getOperand(progCounter,0));
|
||||||
|
SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_LCCX: // long form LCC
|
||||||
StringFormatter::send(stream,F("<LS x%h%h%h%h>\n"),
|
StringFormatter::send(stream,F("<LS x%h%h%h%h>\n"),
|
||||||
getOperand(progCounter,1),
|
getOperand(progCounter,1),
|
||||||
getOperand(progCounter,2),
|
getOperand(progCounter,2),
|
||||||
getOperand(progCounter,3),
|
getOperand(progCounter,3),
|
||||||
getOperand(progCounter,0)
|
getOperand(progCounter,0)
|
||||||
);
|
);
|
||||||
}}
|
SKIPOP;SKIPOP;SKIPOP;SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_ACON: // CBUS ACON
|
||||||
|
case OPCODE_ACOF: // CBUS ACOF
|
||||||
|
StringFormatter::send(stream,F("<LS x%c%h%h>\n"),
|
||||||
|
exrailOpcode==OPCODE_ACOF?'1':'0',
|
||||||
|
getOperand(progCounter,0),getOperand(progCounter,1));
|
||||||
|
SKIPOP;SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
// we stream the hex events we wish to listen to
|
// we stream the hex events we wish to listen to
|
||||||
// and at the same time build the event index looku.
|
// and at the same time build the event index looku.
|
||||||
|
|
||||||
|
case OPCODE_ONLCC:
|
||||||
int eventIndex=0;
|
|
||||||
for (int progCounter=0;; SKIPOP) {
|
|
||||||
byte opcode=GET_OPCODE;
|
|
||||||
if (opcode==OPCODE_ENDEXRAIL) break;
|
|
||||||
if (opcode==OPCODE_ONLCC) {
|
|
||||||
onLCCLookup[eventIndex]=progCounter; // TODO skip...
|
|
||||||
StringFormatter::send(stream,F("<LL %d x%h%h%h:%h>\n"),
|
StringFormatter::send(stream,F("<LL %d x%h%h%h:%h>\n"),
|
||||||
eventIndex,
|
lccEventIndex,
|
||||||
getOperand(progCounter,1),
|
getOperand(progCounter,1),
|
||||||
getOperand(progCounter,2),
|
getOperand(progCounter,2),
|
||||||
getOperand(progCounter,3),
|
getOperand(progCounter,3),
|
||||||
getOperand(progCounter,0)
|
getOperand(progCounter,0)
|
||||||
);
|
);
|
||||||
eventIndex++;
|
SKIPOP;SKIPOP;SKIPOP;SKIPOP;
|
||||||
}
|
// start on handler at next
|
||||||
}
|
onLCCLookup[lccEventIndex]=progCounter;
|
||||||
StringFormatter::send(stream,F("<LR>\n")); // Ready to rumble
|
lccEventIndex++;
|
||||||
opcode=0;
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
case OPCODE_ONACON:
|
||||||
|
case OPCODE_ONACOF:
|
||||||
|
StringFormatter::send(stream,F("<LL %d x%c%h%h>\n"),
|
||||||
|
lccEventIndex,
|
||||||
|
exrailOpcode==OPCODE_ONACOF?'1':'0',
|
||||||
|
getOperand(progCounter,0),getOperand(progCounter,1)
|
||||||
|
);
|
||||||
|
SKIPOP;SKIPOP;
|
||||||
|
// start on handler at next
|
||||||
|
onLCCLookup[lccEventIndex]=progCounter;
|
||||||
|
lccEventIndex++;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
|
if (paramCount==1) { // <L eventid> LCC event arrived from adapter
|
||||||
int16_t eventid=p[0];
|
int16_t eventid=p[0];
|
||||||
bool reject = eventid<0 || eventid>=countLCCLookup;
|
bool reject = eventid<0 || eventid>=countLCCLookup;
|
||||||
|
|
|
@ -189,6 +189,14 @@ bool exrailHalSetup() {
|
||||||
#define LCCX(senderid,eventid) | FEATURE_LCC
|
#define LCCX(senderid,eventid) | FEATURE_LCC
|
||||||
#undef ONLCC
|
#undef ONLCC
|
||||||
#define ONLCC(senderid,eventid) | FEATURE_LCC
|
#define ONLCC(senderid,eventid) | FEATURE_LCC
|
||||||
|
#undef ACON
|
||||||
|
#define ACON(eventid) | FEATURE_LCC
|
||||||
|
#undef ACOF
|
||||||
|
#define ACOF(eventid) | FEATURE_LCC
|
||||||
|
#undef ONACON
|
||||||
|
#define ONACON(eventid) | FEATURE_LCC
|
||||||
|
#undef ONACOF
|
||||||
|
#define ONACOF(eventid) | FEATURE_LCC
|
||||||
#undef ROUTE_ACTIVE
|
#undef ROUTE_ACTIVE
|
||||||
#define ROUTE_ACTIVE(id) | FEATURE_ROUTESTATE
|
#define ROUTE_ACTIVE(id) | FEATURE_ROUTESTATE
|
||||||
#undef ROUTE_INACTIVE
|
#undef ROUTE_INACTIVE
|
||||||
|
@ -429,10 +437,14 @@ const HIGHFLASH int16_t RMFT2::SignalDefinitions[] = {
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
0,0,0,0 };
|
0,0,0,0 };
|
||||||
|
|
||||||
// Pass 9 ONLCC counter and lookup array
|
// Pass 9 ONLCC/ ONMERG counter and lookup array
|
||||||
#include "EXRAIL2MacroReset.h"
|
#include "EXRAIL2MacroReset.h"
|
||||||
#undef ONLCC
|
#undef ONLCC
|
||||||
#define ONLCC(sender,event) +1
|
#define ONLCC(sender,event) +1
|
||||||
|
#undef ONACON
|
||||||
|
#define ONACON(event) +1
|
||||||
|
#undef ONACOF
|
||||||
|
#define ONACOF(event) +1
|
||||||
|
|
||||||
const int RMFT2::countLCCLookup=0
|
const int RMFT2::countLCCLookup=0
|
||||||
#include "myAutomation.h"
|
#include "myAutomation.h"
|
||||||
|
@ -529,6 +541,10 @@ int RMFT2::onLCCLookup[RMFT2::countLCCLookup];
|
||||||
OPCODE_PAD,V((((uint64_t)sender)>>32)&0xFFFF),\
|
OPCODE_PAD,V((((uint64_t)sender)>>32)&0xFFFF),\
|
||||||
OPCODE_PAD,V((((uint64_t)sender)>>16)&0xFFFF),\
|
OPCODE_PAD,V((((uint64_t)sender)>>16)&0xFFFF),\
|
||||||
OPCODE_PAD,V((((uint64_t)sender)>>0)&0xFFFF),
|
OPCODE_PAD,V((((uint64_t)sender)>>0)&0xFFFF),
|
||||||
|
#define ACON(eventid) OPCODE_ACON,V(((uint32_t)eventid >>16) & 0xFFFF),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
|
#define ACOF(eventid) OPCODE_ACOF,V(((uint32_t)eventid >>16) & 0xFFFF),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
|
#define ONACON(eventid) OPCODE_ONACON,V((uint32_t)(eventid) >>16),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
|
#define ONACOF(eventid) OPCODE_ONACOF,V((uint32_t)(eventid) >>16),OPCODE_PAD,V(eventid & 0xFFFF),
|
||||||
#define LCD(id,msg) PRINT(msg)
|
#define LCD(id,msg) PRINT(msg)
|
||||||
#define SCREEN(display,id,msg) PRINT(msg)
|
#define SCREEN(display,id,msg) PRINT(msg)
|
||||||
#define STEALTH(code...) PRINT(dummy)
|
#define STEALTH(code...) PRINT(dummy)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define GITHUB_SHA "devel-202406021945Z"
|
#define GITHUB_SHA "devel-202406182019Z"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
Thus "MAIN"_hk generates exactly the same run time vakue
|
Thus "MAIN"_hk generates exactly the same run time vakue
|
||||||
as const int16_t HASH_KEYWORD_MAIN=11339
|
as const int16_t HASH_KEYWORD_MAIN=11339
|
||||||
*/
|
*/
|
||||||
#ifndef KeywordHAsher_h
|
#ifndef KeywordHasher_h
|
||||||
#define KeywordHasher_h
|
#define KeywordHasher_h
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
|
@ -97,6 +97,18 @@
|
||||||
new MotorDriver(25/* 3*/, 19/*12*/, UNUSED_PIN, 13/*9*/, 35/*A2*/, 1.27, 5000, 36 /*A4*/), \
|
new MotorDriver(25/* 3*/, 19/*12*/, UNUSED_PIN, 13/*9*/, 35/*A2*/, 1.27, 5000, 36 /*A4*/), \
|
||||||
new MotorDriver(23/*11*/, 18/*13*/, UNUSED_PIN, 12/*8*/, 34/*A3*/, 1.27, 5000, 39 /*A5*/)
|
new MotorDriver(23/*11*/, 18/*13*/, UNUSED_PIN, 12/*8*/, 34/*A3*/, 1.27, 5000, 39 /*A5*/)
|
||||||
|
|
||||||
|
// EX-CSB1 with integrated motor driver definition
|
||||||
|
#define EXCSB1 F("EXCSB1"),\
|
||||||
|
new MotorDriver(25, 0, UNUSED_PIN, -14, 34, 2.23, 5000, 19), \
|
||||||
|
new MotorDriver(27, 15, UNUSED_PIN, -2, 35, 2.23, 5000, 23)
|
||||||
|
|
||||||
|
// EX-CSB1 with EX-8874 stacked on top for 4 outputs
|
||||||
|
#define EXCSB1_WITH_EX8874 F("EXCSB1_WITH_EX8874"),\
|
||||||
|
new MotorDriver(25, 0, UNUSED_PIN, -14, 34, 2.23, 5000, 19), \
|
||||||
|
new MotorDriver(27, 15, UNUSED_PIN, -2, 35, 2.23, 5000, 23), \
|
||||||
|
new MotorDriver(26, 5, UNUSED_PIN, 13, 36, 1.52, 5000, 18), \
|
||||||
|
new MotorDriver(16, 4, UNUSED_PIN, 12, 39, 1.52, 5000, 17)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// STANDARD shield on any Arduino Uno or Mega compatible with the original specification.
|
// STANDARD shield on any Arduino Uno or Mega compatible with the original specification.
|
||||||
#define STANDARD_MOTOR_SHIELD F("STANDARD_MOTOR_SHIELD"), \
|
#define STANDARD_MOTOR_SHIELD F("STANDARD_MOTOR_SHIELD"), \
|
||||||
|
|
|
@ -147,6 +147,12 @@ bool WifiESP::setup(const char *SSid,
|
||||||
// enableCoreWDT(1);
|
// enableCoreWDT(1);
|
||||||
// disableCoreWDT(0);
|
// disableCoreWDT(0);
|
||||||
|
|
||||||
|
#ifdef WIFI_LED
|
||||||
|
// Turn off Wifi LED
|
||||||
|
pinMode(WIFI_LED, OUTPUT);
|
||||||
|
digitalWrite(WIFI_LED, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
// clean start
|
// clean start
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.disconnect(true);
|
WiFi.disconnect(true);
|
||||||
|
@ -247,6 +253,13 @@ bool WifiESP::setup(const char *SSid,
|
||||||
// no idea to go on
|
// no idea to go on
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#ifdef WIFI_LED
|
||||||
|
else{
|
||||||
|
// Turn on Wifi connected LED
|
||||||
|
digitalWrite(WIFI_LED, 1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Now Wifi is up, register the mDNS service
|
// Now Wifi is up, register the mDNS service
|
||||||
if(!MDNS.begin(hostname)) {
|
if(!MDNS.begin(hostname)) {
|
||||||
|
|
|
@ -307,11 +307,21 @@ The configuration file for DCC-EX Command Station
|
||||||
//
|
//
|
||||||
//#define SERIAL_BT_COMMANDS
|
//#define SERIAL_BT_COMMANDS
|
||||||
|
|
||||||
// BOOSTER PIN INPUT ON ESP32
|
// BOOSTER PIN INPUT ON ESP32 CS
|
||||||
// On ESP32 you have the possibility to define a pin as booster input
|
// On ESP32 you have the possibility to define a pin as booster input
|
||||||
// Arduio pin D2 is GPIO 26 on ESPDuino32
|
|
||||||
//
|
//
|
||||||
|
// Arduino pin D2 is GPIO 26 is Booster Input on ESPDuino32
|
||||||
//#define BOOSTER_INPUT 26
|
//#define BOOSTER_INPUT 26
|
||||||
|
//
|
||||||
|
// GPIO 32 is Booster Input on EX-CSB1
|
||||||
|
//#define BOOSTER_INPUT 32
|
||||||
|
|
||||||
|
// ESP32 LED Wifi Indicator
|
||||||
|
// GPIO 2 on ESPduino32
|
||||||
|
//#define WIFI_LED 2
|
||||||
|
//
|
||||||
|
// GPIO 33 on EX-CSB1
|
||||||
|
//#define WIFI_LED 33
|
||||||
|
|
||||||
// SABERTOOTH
|
// SABERTOOTH
|
||||||
//
|
//
|
||||||
|
|
11
version.h
11
version.h
|
@ -3,7 +3,16 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.60"
|
#define VERSION "5.2.65"
|
||||||
|
// 5.2.65 - Speedup Exrail SETFREQ
|
||||||
|
// 5.2.64 - Bugfix: <0 PROG> updated to undo JOIN
|
||||||
|
// 5.2.63 - Implement WIFI_LED for ESP32, ESPduino32 and EX-CSB1, that is turned on when STA mode connects or AP mode is up
|
||||||
|
// - Add BOOSTER_INPUT definitions for ESPduino32 and EX-CSB1 to config.example.h
|
||||||
|
// - Add WIFI_LED definitions for ESPduino32 and EX-CSB1 to config.example.h
|
||||||
|
// 5.2.62 - Allow acks way longer than standard
|
||||||
|
// 5.2.61 - Merg CBUS ACON/ACOF/ONACON/ONACOF Adapter interface.
|
||||||
|
// - LCC Adapter interface throttled startup,
|
||||||
|
// (Breaking change woith Adapter base code)
|
||||||
// 5.2.60 - Bugfix: Opcode AFTEROVERLOAD does not have an argument that is a pin and needs to be initialized
|
// 5.2.60 - Bugfix: Opcode AFTEROVERLOAD does not have an argument that is a pin and needs to be initialized
|
||||||
// - Remove inrush throttle after half good time so that we go to mode overload if problem persists
|
// - Remove inrush throttle after half good time so that we go to mode overload if problem persists
|
||||||
// 5.2.59 - STM32 bugfix correct Serial1 definition for Nucleo-F401RE
|
// 5.2.59 - STM32 bugfix correct Serial1 definition for Nucleo-F401RE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user