-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Refactor cm8jl65 driver. Employ uniform initialization, format, and deprecate ringbuffer and IOCTL. #11853
Conversation
63500ef
to
9a54c3c
Compare
e0f1e59
to
e929642
Compare
d0d9f3a
to
719df19
Compare
@cmic0 , would you mind reviewing this PR? Thanks in advance! |
569a28a
to
5bdbbbd
Compare
5bdbbbd
to
d5d6b4c
Compare
4b1fc26
to
b6f0b3a
Compare
b6f0b3a
to
96a7a77
Compare
|
||
}; | ||
ringbuffer::RingBuffer *_reports{nullptr}; |
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.
Can this be gutted entirely (ringbuffer, ioctl, read, etc)?
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.
Unfortunately, not that easily... See my work here. However, if we can get this PR accepted and one to follow it from the continued work in the link I think the issue will become apparent.
I can successfully deprecate IOCTL usage from I2C devices, but not CDev devices. For CDev devices, these calls are still required.
UPDATED: The ringbuffer and read calls might be a little more straightforward. I will address those in subsequent PRs.
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.
Please disregard my comments above. I discovered the issue preventing me from succeeding in deleting the ioctl calls was that the ioctl calls were where the start() method was being called from. Palm->forehead. :}
I have pushed up a commit that is bench tested and accomplishes your requests. I will post a/b comparisons and flight logs as soon as I can get to that work.
8fe329e
to
f5e63d1
Compare
Hi @cmic0 and @dagar , here are flight logs and plots of current PX4 master and this PR on a 250 sized drone, pixhawk 4 mini in position hold mode from ground level incrementing altitude slowly and holding at ~75cm increments up to ~3m.. The results are indistinguishable to me, so I think this PR is good to go. (I would like to squash the commits before merging to keep a clean history, please let me know when I can do this.) PX4 master: https://review.px4.io/plot_app?log=89b6ccba-833f-454f-a0a7-f82078fbb049 This PR: https://review.px4.io/plot_app?log=b09b4f8a-12d4-4d1a-a062-a51852f3b189 |
f5e63d1
to
640de03
Compare
@dagar, ping. |
c17f0b9
to
eb2bc54
Compare
@mcsauder - we need @dagar confirmation but (IIRC) the 300 margin in the stackmon could be reduced to 96-100 - we only stack like 8 registers on the user process stack when an ISR is run. The rest of the penetration is application determined. Without 100% code coverage that worst case is not known. But 96 bytes of overhead is more than enough if the longest call depth has been exercised. |
…st to declarations. Format whitespace and move method doxy comments to declarations.
- Condense all class files into a single *.cpp file and give class scope resolution to previously unscoped methods. - Refactor cm8jl65 namespace level driver entry methods to reduce code and improve clarity. - Breakout CDev specific initialization LOC into the device_init() method. - Move the endian modification inside of the crc16_calc() method.
…the cm8jl65 driver.
… printout and correct a comment in the driver.
eb2bc54
to
a5a81c0
Compare
@mcsauder There are 3 things here.
The hard truth is that #1 will dictate 204 bytes of margin (it does not assume a separate interrupt stack) So I would have stack mon warn at 216 |
Thank you for your review @dagar ! |
(and thank you for your feedback @davids5!!!) |
Describe problem solved by the proposed pull request
This PR refactors the CM8JL65 driver to employ uniform initialization, move the parser and crc16 methods into the CM8JL65 class, move doxy documentation to the method declarations, and formats/standardize the driver structure.
This PR is a step in standardizing the cm8jl65 driver with other distance sensor drivers moving toward resolution of Issue #9279.
Distance sensor drivers and IMU drivers are perhaps the most numerous instances of code duplication in the drivers. Similar work is being undertaken in the IMU drivers as well, (PR #11629). Additional work within this driver will follow this PR.
Additional context
See Issue #9279.
Test data / coverage
This PR has been bench tested and flight tested with pixhawk 4 and pixkhawk 4 mini hardware, see comments below for data plots.
Please let me know if you have questions on this PR. Thanks!
-Mark