mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2025-06-29 18:45:23 +02:00
comment and ifdef cleanup
This commit is contained in:
parent
08b8e43cd0
commit
97f50910f6
@ -131,7 +131,9 @@ void setup()
|
|||||||
RMFT::begin();
|
RMFT::begin();
|
||||||
|
|
||||||
#ifdef ARDUINO_ARCH_ESP32
|
#ifdef ARDUINO_ARCH_ESP32
|
||||||
|
#ifdef BOOSTER_INPUT
|
||||||
dccSniffer = new Sniffer(BOOSTER_INPUT);
|
dccSniffer = new Sniffer(BOOSTER_INPUT);
|
||||||
|
#endif // BOOSTER_INPUT
|
||||||
#endif // ARDUINO_ARCH_ESP32
|
#endif // ARDUINO_ARCH_ESP32
|
||||||
|
|
||||||
// Invoke any DCC++EX commands in the form "SETUP("xxxx");"" found in optional file mySetup.h.
|
// Invoke any DCC++EX commands in the form "SETUP("xxxx");"" found in optional file mySetup.h.
|
||||||
|
@ -64,12 +64,8 @@ public:
|
|||||||
return (bcmp(_data, right._data, _len) == 0);
|
return (bcmp(_data, right._data, _len) == 0);
|
||||||
};
|
};
|
||||||
void print(HardwareSerial &s) {
|
void print(HardwareSerial &s) {
|
||||||
s.print("<* DCCPAKET ");
|
s.print("<* DCCPACKET ");
|
||||||
for (byte n = 0; n< _len; n++) {
|
for (byte n = 0; n< _len; n++) {
|
||||||
// byte b = 8;
|
|
||||||
// while (b--) {
|
|
||||||
// s.print(_data[n]&(1<<b)?"1":"0");
|
|
||||||
// }
|
|
||||||
s.print(_data[n], HEX);
|
s.print(_data[n], HEX);
|
||||||
s.print(" ");
|
s.print(" ");
|
||||||
}
|
}
|
||||||
|
12
Sniffer.cpp
12
Sniffer.cpp
@ -112,12 +112,7 @@ bool Sniffer::inputActive(){
|
|||||||
#define DCC_TOO_SHORT 4000L // 4000 ticks are 50usec
|
#define DCC_TOO_SHORT 4000L // 4000 ticks are 50usec
|
||||||
#define DCC_ONE_LIMIT 6400L // 6400 ticks are 80usec
|
#define DCC_ONE_LIMIT 6400L // 6400 ticks are 80usec
|
||||||
|
|
||||||
volatile int fakecounter = 0;
|
|
||||||
|
|
||||||
void IRAM_ATTR Sniffer::processInterrupt(int32_t capticks, bool posedge) {
|
void IRAM_ATTR Sniffer::processInterrupt(int32_t capticks, bool posedge) {
|
||||||
if (fakecounter >= 64)
|
|
||||||
fakecounter = 0;
|
|
||||||
fakecounter++;
|
|
||||||
byte bit = 0;
|
byte bit = 0;
|
||||||
diffticks = capticks - lastticks;
|
diffticks = capticks - lastticks;
|
||||||
if (lastedge != posedge) {
|
if (lastedge != posedge) {
|
||||||
@ -128,12 +123,7 @@ void IRAM_ATTR Sniffer::processInterrupt(int32_t capticks, bool posedge) {
|
|||||||
bit = 1;
|
bit = 1;
|
||||||
} else {
|
} else {
|
||||||
bit = 0;
|
bit = 0;
|
||||||
}/*
|
}
|
||||||
if (fakecounter == 7 || fakecounter == 34 || fakecounter == 62 || fakecounter == 63) {
|
|
||||||
bit = 0;
|
|
||||||
} else {
|
|
||||||
bit = 1;
|
|
||||||
}*/
|
|
||||||
// update state variables for next round
|
// update state variables for next round
|
||||||
lastticks = capticks;
|
lastticks = capticks;
|
||||||
lastedge = posedge;
|
lastedge = posedge;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user