From 3d4410230b12a741650f653039b5f34642b02f77 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 7 Jan 2019 15:45:03 -0800 Subject: [PATCH] subscribe and unscubscribe consistent --- src/internal/NeoEsp8266UartMethod.cpp | 7 +++++-- src/internal/NeoEsp8266UartMethod.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/internal/NeoEsp8266UartMethod.cpp b/src/internal/NeoEsp8266UartMethod.cpp index 252d3a7..642c1a9 100644 --- a/src/internal/NeoEsp8266UartMethod.cpp +++ b/src/internal/NeoEsp8266UartMethod.cpp @@ -99,8 +99,11 @@ void NeoEsp8266UartInterruptContext::Attach() void NeoEsp8266UartInterruptContext::Detach() { - // uart_unsubscribeInterrupt is safe and does INT enable and disable within it - uart_unsubscribeInterrupt(_uartNum, Isr); + ETS_UART_INTR_DISABLE(); + if (uart_unsubscribeInterrupt(_uartNum, Isr)) + { + ETS_UART_INTR_ENABLE(); + } } void ICACHE_RAM_ATTR NeoEsp8266UartInterruptContext::Isr(void* param) diff --git a/src/internal/NeoEsp8266UartMethod.h b/src/internal/NeoEsp8266UartMethod.h index cf2cc43..dfab0c0 100644 --- a/src/internal/NeoEsp8266UartMethod.h +++ b/src/internal/NeoEsp8266UartMethod.h @@ -114,7 +114,7 @@ public: static const uint32_t Index = 0; static void Init() { - pinMode(1, SPECIAL); + pinMode(1, FUNCTION_0); } };