From 8ca367aad0b4fcf986ed18d2865597dc45fe4b53 Mon Sep 17 00:00:00 2001 From: Davide Perini Date: Mon, 28 Feb 2022 15:33:55 +0100 Subject: [PATCH] Ping ESP is now compatible with newer Arduino SDK --- library.json | 2 +- library.properties | 2 +- src/PingESP.cpp | 14 ++++++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/library.json b/library.json index 89fa780..a100017 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "type": "git", "url": "https://github.com/sblantipodi/arduino_bootstrapper.git" }, - "version": "1.12.5", + "version": "1.12.6", "examples": "examples/*.cpp", "exclude": "tests", "frameworks": "arduino", diff --git a/library.properties b/library.properties index 9cd4e35..6e1f12c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Bootstrapper -version=1.12.5 +version=1.12.6 author=Davide Perini maintainer=Davide Perini sentence=A client library for MQTT messaging. diff --git a/src/PingESP.cpp b/src/PingESP.cpp index b2f8836..9e70ecf 100644 --- a/src/PingESP.cpp +++ b/src/PingESP.cpp @@ -27,11 +27,15 @@ extern "C" void esp_schedule(); extern "C" void esp_yield(); extern "C" void __esp_suspend(); +/** + * Newer Arduino SDK than 3.0.2 does esp_schedule() inside esp_yield(), this break ping functions here. + * Direct alternative would be to use new esp_suspend(). + * Continue to use esp_yield() implementation when there is no esp_suspend() function (<= 3.0.2), + * use new esp_suspend() instead (> 3.0.2). + */ extern "C" void suspend_or_yield() { - Serial.printf("This is the default handler\n"); esp_yield(); } - void __esp_suspend(void) __attribute__((weak, alias("suspend_or_yield"))); PingESP::PingESP() {} @@ -80,10 +84,4 @@ void PingESP::receivePingCallback(void *opt, void *resp) { esp_schedule(); } } - -///** -// * Weak function, if there is some implementation of esp_suspend() elsewhere, use that implementation, -// * use this implementation instead. -// */ - #endif \ No newline at end of file