-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bhy2_get_and_process_fifo does not work #2
Comments
Not the owner of this repository, but I was looking at open issues and found yours, The version of the library checked in this repository on May 13 2020, has the following starting at line 1147. It looks as if you are referring to a different version of the library, given the different coding conventions and line numbering I recently ported the library to a Nordic microprocessor, and callbacks work as expected
|
Ah, looks like I made a mistake in writing the line numbers in my original comment. I meant to write "lines 1338 and 1339" instead of "1138 and 1139". I've updated it now. Thanks for catching that. Interesting that the callbacks are working for you but not for me. I ported the code for use on a SAM D51. |
But... those lines (1338, etc) are for the get_callback_info(), which is not supposed to set any callback. Not for the bhy2_register_fifo_parse_callback() as your issue originally refers to Also, the current version of the library uses
and not
you have info-> and the current code has dev-> Let me ask again: you really using the library in this repository or a different version? Mine works because the code is written as you suggest should be written :) but it has been that way for almost two years (in this repository) |
I had to make this change to get the example program in euler.c, version 5b26dc4. |
I'm not making myself clear, sorry. Try downloading this repository and compare it with your version of the same library. The code you refer to, doesn't exist in this repository. I believe you are using a version you downloaded from somewhere else. I understand how the code works. I ported it to a Nordic processor (Arm M4 core), and the callbacks work as expected (from bhy2_get_and_process_fifo() which in turns calls parse_fifo(). The code in this repository correctly registers all callbacks |
My initial complaint was that the callbacks that were registered with I cloned this repository directly from GitHub using git, and the code that I mentioned exists in this repository as I've specified: https://github.com/BoschSensortec/BHY2-Sensor-API/blob/5b26dc4802f500f75e1086c2a156e3ecf800560c/bhy2.c#L1338 |
As I said, it's working for me, for all the virtual sensors I register and initialize My reading of the get_callback_info() function, is that it "nulls" the callback pointers only if one of these two conditions is met
In both those cases, you want the callbacks to be NULL (BHY2_SPECIAL_SENSOR_ID_OFFSET is 245, so higher than any standard virtual sensor in all the other cases, the callback pointers are retained from the previous registration, and invoked by line 1481 in parse_fifo() Your proposed fix will not help in the normal code flow, and actually risks causing problems to the proper code execution (once again, I'm saying this as a semi-clueless user of this library and in the spirit of trying to help) |
I appreciate the discussion on this. I'm also semi-clueless on this library. I was just posting the change that I made in order to make to get the example program in euler.c to work. Perhaps there is something else wrong with that example. |
Unrelated comment: @robcazzaro I need also to implement this in a nordic micro. Could you share with me what you have done so far? |
UPDATE: nRF52 port is now available here https://github.com/robcazzaro/nRF52-BHY2-Sensor-API @dariosortino I never took the time to clean things up and post it. But I should :) To give you at least a starting point, I created a placeholder project and added an issue where you can see what I did and ask questions. I don't want to sidetrack this issue with unrelated content. Please feel free to add comments/questions to robcazzaro/nRF52_BHY2_API#1 For what is worth, it's working really well and even if the lack of documentation is annoying, the Bosch BHY2 library is well written and functional. I have not found any bug yet |
bhy2_get_and_process_fifo
does not fire callbacks that were added withbhy2_register_fifo_parse_callback
The reason for this is that the callback is not properly retrieved in the
get_callback_info
function. There are bugs on lines11381338 and11391339 of bhy2.c. Instead of:those lines should be:
When this change is made, then callbacks that were registered with
bhy2_register_fifo_parse_callback
are called when the appropriate data is in the FIFO, whenbhy2_get_and_process_fifo
is called.The text was updated successfully, but these errors were encountered: