Skip to content

Commit 164aa67

Browse files
Add note about blocking and receiving within callbacks
1 parent 46e0be8 commit 164aa67

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

XBee.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,17 @@ class XBee {
826826
* XBee class, so there is no need to do so directly (though it should
827827
* not mess with this class if you do, it would only mean some callbacks
828828
* aren't called).
829+
*
830+
* Inside callbacks, you should generally not be blocking / waiting.
831+
* Since callbacks can be called from inside waitFor() and friends, a
832+
* callback that doesn't return quickly can mess up the waitFor()
833+
* timeout.
834+
*
835+
* Sending packets is not a problem inside a callback, but avoid
836+
* receiving a packet (e.g. calling readPacket(), loop() or waitFor()
837+
* and friends) inside a callback (since that would overwrite the
838+
* current response, messing up any pending callbacks and waitFor() etc.
839+
* methods already running).
829840
*/
830841
class XBeeWithCallbacks : public XBee {
831842
public:

0 commit comments

Comments
 (0)