Skip to content

Commit

Permalink
Ping ESP is now compatible with newer Arduino SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
sblantipodi committed Feb 28, 2022
1 parent d6de140 commit 8ca367a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Bootstrapper
version=1.12.5
version=1.12.6
author=Davide Perini <[email protected]>
maintainer=Davide Perini <[email protected]>
sentence=A client library for MQTT messaging.
Expand Down
14 changes: 6 additions & 8 deletions src/PingESP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
Expand Down Expand Up @@ -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

0 comments on commit 8ca367a

Please sign in to comment.