mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-03-15 10:33:07 +01:00
Compare commits
5 Commits
a2fb58584f
...
b89508671c
Author | SHA1 | Date | |
---|---|---|---|
|
b89508671c | ||
|
9f1257bc6c | ||
|
5f65fd5944 | ||
|
a26610bc7f | ||
|
264a53dacf |
@ -76,8 +76,13 @@ int DCCTimer::freeMemory() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
|
||||||
|
#include "esp_idf_version.h"
|
||||||
|
#if ESP_IDF_VERSION_MAJOR > 4
|
||||||
|
#error "DCC-EX does not support compiling with IDF version 5.0 or later. Downgrade your ESP32 library to a version that contains IDE version 4. Arduino ESP32 library 3.0.0 is too new. Downgrade to one of 2.0.9 to 2.0.17"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "DIAG.h"
|
#include "DIAG.h"
|
||||||
#include <driver/adc.h>
|
#include <driver/adc.h>
|
||||||
#include <soc/sens_reg.h>
|
#include <soc/sens_reg.h>
|
||||||
|
@ -61,61 +61,82 @@ 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
|
||||||
StringFormatter::send(stream,F("<LS x%h%h%h%h>\n"),
|
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"),
|
||||||
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;
|
||||||
if (opcode==OPCODE_ACON) StringFormatter::send(stream,F("<LS x0%h%h>\n"),
|
lccProgCounter=progCounter;
|
||||||
getOperand(progCounter,0),getOperand(progCounter,1));
|
return;
|
||||||
if (opcode==OPCODE_ACOF) StringFormatter::send(stream,F("<LS x1%h%h>\n"),
|
|
||||||
getOperand(progCounter,0),getOperand(progCounter,1));
|
case OPCODE_ACON: // CBUS ACON
|
||||||
}
|
case OPCODE_ACOF: // CBUS ACON
|
||||||
|
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;
|
onLCCLookup[lccEventIndex]=progCounter;
|
||||||
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++;
|
lccEventIndex++;
|
||||||
}
|
SKIPOP;SKIPOP;SKIPOP;SKIPOP;
|
||||||
if (opcode==OPCODE_ONACON || opcode==OPCODE_ONACOF) {
|
lccProgCounter=progCounter;
|
||||||
onLCCLookup[eventIndex]=progCounter; // TODO skip...
|
return;
|
||||||
|
|
||||||
|
case OPCODE_ONACON:
|
||||||
|
case OPCODE_ONACOF:
|
||||||
|
onLCCLookup[lccEventIndex]=progCounter;
|
||||||
StringFormatter::send(stream,F("<LL %d x%c%h%h>\n"),
|
StringFormatter::send(stream,F("<LL %d x%c%h%h>\n"),
|
||||||
eventIndex,
|
lccEventIndex,
|
||||||
opcode==OPCODE_ONACON?'0':'1',
|
exrailOpcode==OPCODE_ONACOF?'1':'0',
|
||||||
getOperand(progCounter,0),getOperand(progCounter,1)
|
getOperand(progCounter,0),getOperand(progCounter,1)
|
||||||
);
|
);
|
||||||
eventIndex++;
|
lccEventIndex++;
|
||||||
|
SKIPOP;SKIPOP;
|
||||||
|
lccProgCounter=progCounter;
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringFormatter::send(stream,F("<LR>\n")); // Ready to rumble
|
|
||||||
opcode=0;
|
|
||||||
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];
|
||||||
|
@ -1 +1 @@
|
|||||||
#define GITHUB_SHA "devel-202405232026Z"
|
#define GITHUB_SHA "devel-202406021945Z"
|
||||||
|
@ -164,7 +164,11 @@ monitor_echo = yes
|
|||||||
build_flags = -mcall-prologues
|
build_flags = -mcall-prologues
|
||||||
|
|
||||||
[env:ESP32]
|
[env:ESP32]
|
||||||
platform = espressif32
|
; Lock version to 6.7.0 as that is
|
||||||
|
; Arduino v2.0.16 (based on IDF v4.4.7)
|
||||||
|
; which is the latest version based
|
||||||
|
; on IDF v4. We can not use IDF v5.
|
||||||
|
platform = espressif32 @ 6.7.0
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps = ${env.lib_deps}
|
||||||
|
Loading…
Reference in New Issue
Block a user