From 313380381b8b40ae3a139addd0a5dbf8754f6647 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 27 May 2020 15:40:47 -0700 Subject: [PATCH 1/2] no need for this old debug output --- src/sleep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sleep.cpp b/src/sleep.cpp index 4b8db06b..270ecc5c 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -273,7 +273,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause(); if (cause == ESP_SLEEP_WAKEUP_GPIO) - DEBUG_MSG("Exit light sleep gpio: btn=%d, rf95=%d\n", !digitalRead(BUTTON_PIN), digitalRead(RF95_IRQ_GPIO)); + DEBUG_MSG("Exit light sleep gpio: btn=%d\n", !digitalRead(BUTTON_PIN)); return cause; } From 1b34a0c6d8190689d9f9c2fcc1aebcd625ec5802 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 27 May 2020 15:47:59 -0700 Subject: [PATCH 2/2] Help make sx1262 go for @dafeman 's board. See below for details: Hi, I think the problem you were having building for ESP32 was due to a funny thing. Notice the #define for INTERRUPT_ATTR. That macro expands to IRAM_ATTR - which is a special flag the ESP32 requires for _any_ code that is going to be called from an ISR. So that the code is guaranteed to be in RAM (the ESP32 uses a clever scheme where the FLASH is actually high speed serial flash and all reads/writes are actually only happening to a small number of pages in RAM and they have a driver that is constantly copying blocks they need into that ram. This essentially how VM works for desktop computers, but in their case they are paging to FLASH. But for code that runs in an interrupt handler must _always_ be in RAM because if you took a 'page fault' for that code being missing in RAM they can't nicely do their clever VM scheme. So that's all good. The problem was - apparently GCC for the ESP32 has a a bug when that attribute is applied in the class declaration. So I moved it out into the cpp file and all seems well now. --- src/mesh/SX1262Interface.cpp | 5 +++++ src/mesh/SX1262Interface.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mesh/SX1262Interface.cpp b/src/mesh/SX1262Interface.cpp index dadd98d0..69e7f8ee 100644 --- a/src/mesh/SX1262Interface.cpp +++ b/src/mesh/SX1262Interface.cpp @@ -71,6 +71,11 @@ bool SX1262Interface::reconfigure() return ERR_NONE; } +void INTERRUPT_ATTR SX1262Interface::disableInterrupt() +{ + lora.clearDio1Action(); +} + void SX1262Interface::setStandby() { int err = lora.standby(); diff --git a/src/mesh/SX1262Interface.h b/src/mesh/SX1262Interface.h index c1e1fb1c..92b301bf 100644 --- a/src/mesh/SX1262Interface.h +++ b/src/mesh/SX1262Interface.h @@ -29,7 +29,7 @@ class SX1262Interface : public RadioLibInterface /** * Glue functions called from ISR land */ - virtual void INTERRUPT_ATTR disableInterrupt() { lora.clearDio1Action(); } + virtual void disableInterrupt(); /** * Enable a particular ISR callback glue function