-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pbdrv/ioport: Add debug prints for LPF2 detection events.
This makes it easier to see failed device detection events such as in pybricks/support#500.
- Loading branch information
1 parent
f57e76e
commit aa5712f
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aa5712f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, using the Pybricks MicroPython implementation of
printf
can cause issues with reentrancy here since it can be block and will call the contiki event loop from within the contiki event loop.aa5712f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was copied from uartdev, so we might want to fix it there too then.
It usually works well enough for occasional debugging, so perhaps good enough for now.
aa5712f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The uartdev stuff was copied from the Linux kernel drivers, so I left it in.
When using debug prints like this, I go in an modify the Bluetooth stdout code so that it can't possibly block (drops output if buffer overflows instead of returning
PBIO_ERROR_AGAIN
) and increase the buffer size. This avoids the reentrany issues.aa5712f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also a
PYBRICKS_HUB_DEBUG
option for sending stdout to a UART instead of Bluetooth. This is blocking, so can cause timing issue, but avoids the reentrancy issues.