Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
954e2b3525 | ||
|
f994cab0c5 | ||
|
ee89abe4d7 | ||
|
885cf9fc64 | ||
|
08da67f3c6 | ||
|
b1cd7622e3 |
14
NmraDcc.cpp
14
NmraDcc.cpp
@@ -267,6 +267,9 @@
|
|||||||
#elif defined ( ARDUINO_ARCH_RP2040)
|
#elif defined ( ARDUINO_ARCH_RP2040)
|
||||||
static PinStatus ISREdge; // Holder of the Next Edge we're looking for: RISING or FALLING
|
static PinStatus ISREdge; // Holder of the Next Edge we're looking for: RISING or FALLING
|
||||||
static byte ISRWatch; // Interrupt Handler Edge Filter
|
static byte ISRWatch; // Interrupt Handler Edge Filter
|
||||||
|
#elif defined ( ARDUINO_ARCH_RENESAS_UNO)
|
||||||
|
static PinStatus ISREdge; // Holder of the Next Edge we're looking for: RISING or FALLING
|
||||||
|
static byte ISRWatch; // Interrupt Handler Edge Filter
|
||||||
#else
|
#else
|
||||||
static byte ISREdge; // Holder of the Next Edge we're looking for: RISING or FALLING
|
static byte ISREdge; // Holder of the Next Edge we're looking for: RISING or FALLING
|
||||||
static byte ISRWatch; // Interrupt Handler Edge Filter
|
static byte ISRWatch; // Interrupt Handler Edge Filter
|
||||||
@@ -680,7 +683,7 @@ DCC_PROCESSOR_STATE DccProcState ;
|
|||||||
portENTER_CRITICAL_ISR (&mux);
|
portENTER_CRITICAL_ISR (&mux);
|
||||||
#endif
|
#endif
|
||||||
DccRx.PacketCopy = DccRx.PacketBuf ;
|
DccRx.PacketCopy = DccRx.PacketBuf ;
|
||||||
DccRx.DataReady = 1 ;
|
DccRx.DataReady += 1 ;
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
portEXIT_CRITICAL_ISR (&mux);
|
portEXIT_CRITICAL_ISR (&mux);
|
||||||
#endif
|
#endif
|
||||||
@@ -809,7 +812,7 @@ void writeEEPROM (unsigned int CV, uint8_t Value)
|
|||||||
{
|
{
|
||||||
EEPROM.write (CV, Value) ;
|
EEPROM.write (CV, Value) ;
|
||||||
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
#if defined(ESP8266)
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -817,7 +820,7 @@ void writeEEPROM (unsigned int CV, uint8_t Value)
|
|||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ESP8266) || defined(ESP32)
|
#if defined(ESP8266)
|
||||||
interrupts();
|
interrupts();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1728,6 +1731,8 @@ void NmraDcc::setAccDecDCCAddrNextReceived (uint8_t enable)
|
|||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
uint8_t NmraDcc::process()
|
uint8_t NmraDcc::process()
|
||||||
{
|
{
|
||||||
|
uint8_t copyDataReady ;
|
||||||
|
|
||||||
if (DccProcState.inServiceMode)
|
if (DccProcState.inServiceMode)
|
||||||
{
|
{
|
||||||
if ( (millis() - DccProcState.LastServiceModeMillis) > 20L)
|
if ( (millis() - DccProcState.LastServiceModeMillis) > 20L)
|
||||||
@@ -1745,6 +1750,7 @@ uint8_t NmraDcc::process()
|
|||||||
noInterrupts();
|
noInterrupts();
|
||||||
#endif
|
#endif
|
||||||
Msg = DccRx.PacketCopy ;
|
Msg = DccRx.PacketCopy ;
|
||||||
|
copyDataReady = DccRx.DataReady;
|
||||||
DccRx.DataReady = 0 ;
|
DccRx.DataReady = 0 ;
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@@ -1762,7 +1768,7 @@ uint8_t NmraDcc::process()
|
|||||||
if (notifyDccMsg) notifyDccMsg (&Msg);
|
if (notifyDccMsg) notifyDccMsg (&Msg);
|
||||||
|
|
||||||
execDccProcessor (&Msg);
|
execDccProcessor (&Msg);
|
||||||
return 1 ;
|
return copyDataReady ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
|
@@ -127,7 +127,9 @@ typedef struct
|
|||||||
#define PRIO_DCC_IRQ 9
|
#define PRIO_DCC_IRQ 9
|
||||||
#define PRIO_SYSTIC 8 // MUST be higher priority than DCC Irq
|
#define PRIO_SYSTIC 8 // MUST be higher priority than DCC Irq
|
||||||
#elif defined(ARDUINO_ARCH_RP2040)
|
#elif defined(ARDUINO_ARCH_RP2040)
|
||||||
#define MAXCV 256 // todo: maybe somebody knows a good define for it
|
#define MAXCV 256 // todo: maybe somebody knows a good define for it
|
||||||
|
#elif defined ( ARDUINO_ARCH_RENESAS_UNO)
|
||||||
|
#define MAXCV EEPROM.length()
|
||||||
#elif defined(ARDUINO_SAMD_ZERO)
|
#elif defined(ARDUINO_SAMD_ZERO)
|
||||||
#define MAXCV EEPROM_EMULATION_SIZE
|
#define MAXCV EEPROM_EMULATION_SIZE
|
||||||
#else
|
#else
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#define DCC_PIN 2
|
#define DCC_PIN 2
|
||||||
|
|
||||||
// Define the DCC Turnout Address to select the first level = 1
|
// Define the DCC Turnout Address to select the first level = 1
|
||||||
#define DCC_ACCESSORY_DECODER_BASE_ADDRESS 200
|
#define DCC_ACCESSORY_DECODER_BASE_ADDRESS 500
|
||||||
|
|
||||||
// Define the manimus numbr of Levels
|
// Define the manimus numbr of Levels
|
||||||
#define NUM_LIFT_LEVELS 8
|
#define NUM_LIFT_LEVELS 8
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
#define BUTTON_LONG_PRESS_DELAY 2000
|
#define BUTTON_LONG_PRESS_DELAY 2000
|
||||||
|
|
||||||
// Uncomment ONE of the next 2 lines to enable AJS or UWE Board Settings
|
// Uncomment ONE of the next 2 lines to enable AJS or UWE Board Settings
|
||||||
//#define AJS_BOARD_SETTINGS
|
// #define AJS_BOARD_SETTINGS
|
||||||
#define UWE_BOARD_SETTINGS
|
#define UWE_BOARD_SETTINGS
|
||||||
|
|
||||||
#if defined(AJS_BOARD_SETTINGS) // Setting for AJS Dev System
|
#if defined(AJS_BOARD_SETTINGS) // Setting for AJS Dev System
|
||||||
@@ -267,9 +267,9 @@ elapsedMillis lastSpeedChange = 0;
|
|||||||
// The DCC Turnout Address is checked to see if it is within the range used to Select Elevator levels and starts a Move if a new level is selected
|
// The DCC Turnout Address is checked to see if it is within the range used to Select Elevator levels and starts a Move if a new level is selected
|
||||||
void notifyDccAccTurnoutOutput(uint16_t receivedAddress, uint8_t direction, uint8_t outputPower)
|
void notifyDccAccTurnoutOutput(uint16_t receivedAddress, uint8_t direction, uint8_t outputPower)
|
||||||
{
|
{
|
||||||
if((receivedAddress >= DCC_ACCESSORY_DECODER_BASE_ADDRESS) && (receivedAddress < (DCC_ACCESSORY_DECODER_BASE_ADDRESS + NUM_LIFT_LEVELS)))
|
if((receivedAddress >= DCC_ACCESSORY_DECODER_BASE_ADDRESS) && (receivedAddress < (DCC_ACCESSORY_DECODER_BASE_ADDRESS + (NUM_LIFT_LEVELS/2))))
|
||||||
{
|
{
|
||||||
uint8_t newLevel = receivedAddress - DCC_ACCESSORY_DECODER_BASE_ADDRESS;
|
uint8_t newLevel = (receivedAddress - DCC_ACCESSORY_DECODER_BASE_ADDRESS) * 2 + direction;
|
||||||
if(persistentValues.lastLiftLevel != newLevel)
|
if(persistentValues.lastLiftLevel != newLevel)
|
||||||
{
|
{
|
||||||
persistentValues.lastLiftLevel = newLevel;
|
persistentValues.lastLiftLevel = newLevel;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=NmraDcc
|
name=NmraDcc
|
||||||
version=2.0.15
|
version=2.0.17
|
||||||
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda), Hans Tanner, bugfixes by Jueff
|
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda), Hans Tanner, bugfixes by Jueff
|
||||||
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
||||||
sentence=Enables NMRA DCC Communication
|
sentence=Enables NMRA DCC Communication
|
||||||
|
Reference in New Issue
Block a user