1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

fill in debug and unsupported drivers

This commit is contained in:
Asbelos 2024-02-07 21:24:48 +00:00
parent 1443ea8df9
commit 7a9e225602
7 changed files with 69 additions and 8 deletions

View File

@ -1036,10 +1036,27 @@ bool DCCEXParser::parseC(Print *stream, int16_t params, int16_t p[]) {
DIAG(F("128 Speedsteps")); DIAG(F("128 Speedsteps"));
return true; return true;
case "RAILCOM"_hk: case "RAILCOM"_hk:
{ { // <C RAILCOM ON|OFF|DEBUG >
bool onOff = (params > 1) && (p[1] == 1 || p[1] == "ON"_hk); // dont care if other stuff or missing... just means off if (params<2) return false;
bool on=false;
bool debug=false;
switch (p[1]) {
case "ON"_hk:
case 1:
on=true;
break;
case "DEBUG"_hk:
on=true;
debug=true;
break;
case "OFF"_hk:
case 0:
break;
default:
return false;
}
DIAG(F("Railcom %S") DIAG(F("Railcom %S")
,DCCWaveform::setRailcom(onOff)?F("ON"):F("OFF")); ,DCCWaveform::setRailcom(on,debug)?F("ON"):F("OFF"));
return true; return true;
} }
#ifndef DISABLE_PROG #ifndef DISABLE_PROG

View File

@ -80,6 +80,14 @@ extern char *__malloc_heap_start;
interruptHandler(); interruptHandler();
} }
void DCCTimer::startRailcomTimer(byte brakePin) {
// TODO: for intended operation see DCCTimerAVR.cpp
}
void DCCTimer::ackRailcomTimer() {
// TODO: for intended operation see DCCTimerAVR.cpp
}
bool DCCTimer::isPWMPin(byte pin) { bool DCCTimer::isPWMPin(byte pin) {
(void) pin; (void) pin;
return false; // TODO what are the relevant pins? return false; // TODO what are the relevant pins?

View File

@ -76,6 +76,14 @@ void DCCTimer::begin(INTERRUPT_CALLBACK callback) {
interrupts(); interrupts();
} }
void DCCTimer::startRailcomTimer(byte brakePin) {
// TODO: for intended operation see DCCTimerAVR.cpp
}
void DCCTimer::ackRailcomTimer() {
// TODO: for intended operation see DCCTimerAVR.cpp
}
// Timer IRQ handlers replace the dummy handlers (in cortex_handlers) // Timer IRQ handlers replace the dummy handlers (in cortex_handlers)
// copied from rf24 branch // copied from rf24 branch
void TCC0_Handler() { void TCC0_Handler() {

View File

@ -201,6 +201,14 @@ void DCCTimer::begin(INTERRUPT_CALLBACK callback) {
interrupts(); interrupts();
} }
void DCCTimer::startRailcomTimer(byte brakePin) {
// TODO: for intended operation see DCCTimerAVR.cpp
}
void DCCTimer::ackRailcomTimer() {
// TODO: for intended operation see DCCTimerAVR.cpp
}
bool DCCTimer::isPWMPin(byte pin) { bool DCCTimer::isPWMPin(byte pin) {
//TODO: STM32 whilst this call to digitalPinHasPWM will reveal which pins can do PWM, //TODO: STM32 whilst this call to digitalPinHasPWM will reveal which pins can do PWM,
// there's no support yet for High Accuracy, so for now return false // there's no support yet for High Accuracy, so for now return false

View File

@ -39,6 +39,14 @@ void DCCTimer::begin(INTERRUPT_CALLBACK callback) {
myDCCTimer.begin(interruptHandler, DCC_SIGNAL_TIME); myDCCTimer.begin(interruptHandler, DCC_SIGNAL_TIME);
} }
void DCCTimer::startRailcomTimer(byte brakePin) {
// TODO: for intended operation see DCCTimerAVR.cpp
}
void DCCTimer::ackRailcomTimer() {
// TODO: for intended operation see DCCTimerAVR.cpp
}
bool DCCTimer::isPWMPin(byte pin) { bool DCCTimer::isPWMPin(byte pin) {
//Teensy: digitalPinHasPWM, todo //Teensy: digitalPinHasPWM, todo
(void) pin; (void) pin;

View File

@ -117,14 +117,17 @@ DCCWaveform::DCCWaveform( byte preambleBits, bool isMain) {
} }
volatile bool DCCWaveform::railcomActive=false; // switched on by user volatile bool DCCWaveform::railcomActive=false; // switched on by user
volatile bool DCCWaveform::railcomDebug=false; // switched on by user
bool DCCWaveform::setRailcom(bool on) { bool DCCWaveform::setRailcom(bool on, bool debug) {
if (on) { if (on) {
// TODO check possible // TODO check possible
railcomActive=true; railcomActive=true;
railcomDebug=debug;
} }
else { else {
railcomActive=false; railcomActive=false;
railcomDebug=false;
} }
return railcomActive; return railcomActive;
} }
@ -225,9 +228,11 @@ void DCCWaveform::promotePendingPacket() {
// nothing to do, just send idles or resets // nothing to do, just send idles or resets
// Fortunately reset and idle packets are the same length // Fortunately reset and idle packets are the same length
// TEMPORARY DEBUG FOR RAILCOM // Note: If railcomDebug is on, then we send resets to the main
// memcpy( transmitPacket, isMainTrack ? idlePacket : resetPacket, sizeof(idlePacket)); // track instead of idles. This means that all data will be zeros
memcpy( transmitPacket, resetPacket, sizeof(idlePacket)); // and only the porersets will be ones, making it much
// easier to read on a logic analyser.
memcpy( transmitPacket, (isMainTrack && (!railcomDebug)) ? idlePacket : resetPacket, sizeof(idlePacket));
transmitLength = sizeof(idlePacket); transmitLength = sizeof(idlePacket);
transmitRepeats = 0; transmitRepeats = 0;
if (getResets() < 250) sentResetsSincePacket++; // only place to increment (private!) if (getResets() < 250) sentResetsSincePacket++; // only place to increment (private!)
@ -316,4 +321,10 @@ bool DCCWaveform::isReminderWindowOpen() {
void IRAM_ATTR DCCWaveform::loop() { void IRAM_ATTR DCCWaveform::loop() {
DCCACK::checkAck(progTrack.getResets()); DCCACK::checkAck(progTrack.getResets());
} }
bool DCCWaveform::setRailcom(bool on, bool debug) {
// TODO... ESP32 railcom waveform
return false;
}
#endif #endif

View File

@ -85,7 +85,7 @@ class DCCWaveform {
void schedulePacket(const byte buffer[], byte byteCount, byte repeats); void schedulePacket(const byte buffer[], byte byteCount, byte repeats);
bool isReminderWindowOpen(); bool isReminderWindowOpen();
void promotePendingPacket(); void promotePendingPacket();
static bool setRailcom(bool on); static bool setRailcom(bool on, bool debug);
static bool isRailcom() {return railcomActive;} static bool isRailcom() {return railcomActive;}
private: private:
@ -113,6 +113,7 @@ class DCCWaveform {
byte pendingLength; byte pendingLength;
byte pendingRepeats; byte pendingRepeats;
static volatile bool railcomActive; // switched on by user static volatile bool railcomActive; // switched on by user
static volatile bool railcomDebug; // switched on by user
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
static RMTChannel *rmtMainChannel; static RMTChannel *rmtMainChannel;