From f5f1bde1fe9e72f051f80cf500bad78efbc9dfff Mon Sep 17 00:00:00 2001 From: Rodrigo Alfonso Date: Mon, 27 Jan 2025 09:32:59 -0300 Subject: [PATCH] FIX: When using LINK_WIRELESS_ENABLE_NESTED_IRQ, preventing acknowledge from being interrupted --- lib/LinkRawWireless.hpp | 7 +++++++ lib/LinkWireless.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/LinkRawWireless.hpp b/lib/LinkRawWireless.hpp index 0b6b2a7..b2d1a78 100644 --- a/lib/LinkRawWireless.hpp +++ b/lib/LinkRawWireless.hpp @@ -1146,6 +1146,13 @@ class LinkRawWireless { asyncCommand.direction == AsyncCommand::Direction::SENDING) { if (!acknowledge()) return -4; + +#ifdef LINK_WIRELESS_PUT_ISR_IN_IWRAM +#ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ + Link::_REG_IME = 1; +#endif +#endif + sendAsyncCommand(newData, _clockInversionSupport); } else if (_clockInversionSupport) { if (!reverseAcknowledge(asyncCommand.step == diff --git a/lib/LinkWireless.cpp b/lib/LinkWireless.cpp index dd6305d..1fdedd4 100644 --- a/lib/LinkWireless.cpp +++ b/lib/LinkWireless.cpp @@ -6,7 +6,7 @@ LINK_CODE_IWRAM void LinkWireless::_onSerial() { #ifdef LINK_WIRELESS_ENABLE_NESTED_IRQ interrupt = true; LINK_BARRIER; - Link::_REG_IME = 1; + // (nested interrupts are enabled by LinkRawWireless::_onSerial(...)) #endif __onSerial();