-
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
SF45 fixes to restart the state machine if sensor does not init correctly #23565
Conversation
Signed-off-by: dirksavage88 <[email protected]>
Signed-off-by: dirksavage88 <[email protected]>
Signed-off-by: dirksavage88 <[email protected]>
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
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.
Hi @dirksavage88, thanks for the PR 👍
The changes look mostly good. I have noted some findings.
Please just comment if you have any questions. Have a nice day.
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
…nsor bring-up Signed-off-by: dirksavage88 <[email protected]>
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.
Thanks for the update, looks good 👍.
I just have some additional questions regarding the general program flow.
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp
Outdated
Show resolved
Hide resolved
…op with consec errors if over the fail count and not init Signed-off-by: dirksavage88 <[email protected]>
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.
Thanks for commenting on all the open topics and fixing all of them 👍
The changes look good to me.
Fixes #23308 when the SF45 is on specific UARTS, the sensor never reports distance data due to being stuck in init.
Also populates comms_errs if there are issues reading/writing data.
The serial uart data being read reports the start of packet invalid, payload length invalid, and CRC mismatch in the early sensor init state, so the SF_STREAM command never gets sent out. This PR restarts the state machine if there are too many consecutive errors in the beginning that are the result of UART data mismatch on what the driver expects and what the sensor sends. For unknown reasons the sensor seems to work much better on TELEM1 and TELEM2
Tested on holybro 6x where TELEM 1 and TELEM2 worked fine with the original driver, but TELEM3 did not and the start of packet invalids caused the sensor to never stream distance data. With this fix the driver actually reports distance data on telem 3.