added conditional compilation for ESP8266 to add ICACHE_RAM_ATTR to ExternalInterruptHandler

changed storage for Micros to unsigned long
This commit is contained in:
Alex Shepherd
2019-05-25 15:52:55 +12:00
parent b249762550
commit 6d12e6cd3f

View File

@@ -310,6 +310,8 @@ DCC_PROCESSOR_STATE DccProcState ;
portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED; portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
void IRAM_ATTR ExternalInterruptHandler(void) void IRAM_ATTR ExternalInterruptHandler(void)
#elif defined(ESP8266)
void ICACHE_RAM_ATTR ExternalInterruptHandler(void)
#else #else
void ExternalInterruptHandler(void) void ExternalInterruptHandler(void)
#endif #endif
@@ -340,9 +342,9 @@ void ExternalInterruptHandler(void)
// Bit evaluation without Timer 0 ------------------------------ // Bit evaluation without Timer 0 ------------------------------
uint8_t DccBitVal; uint8_t DccBitVal;
static int8_t bit1, bit2 ; static int8_t bit1, bit2 ;
static word lastMicros; static unsigned long lastMicros = 0;
static byte halfBit, DCC_IrqRunning; static byte halfBit, DCC_IrqRunning;
unsigned int actMicros, bitMicros; unsigned long actMicros, bitMicros;
if ( DCC_IrqRunning ) { if ( DCC_IrqRunning ) {
// nested DCC IRQ - obviously there are glitches // nested DCC IRQ - obviously there are glitches
// ignore this interrupt and increment glitchcounter // ignore this interrupt and increment glitchcounter