Skip to content
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

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

dirksavage88
Copy link
Contributor

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.

errors
sf45

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-sep-11-2024/40625/4

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-sep-18-2024/40762/2

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-sep-18-2024/40762/1

@alexcekay alexcekay self-requested a review September 19, 2024 15:57
Copy link
Member

@alexcekay alexcekay left a 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.

Copy link
Member

@alexcekay alexcekay left a 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.

…op with consec errors if over the fail count and not init

Signed-off-by: dirksavage88 <[email protected]>
@dirksavage88
Copy link
Contributor Author

Typically the sensor fails to init on the first try on some uarts. But with the restart of the state machine it gets it on the 2nd try:
lightwaresf45restart

Copy link
Member

@alexcekay alexcekay left a 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.

@alexcekay alexcekay merged commit b41811b into PX4:main Sep 23, 2024
52 checks passed
@dirksavage88 dirksavage88 deleted the sf45_uart_fix branch September 23, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Distance sensor LIDAR Lightware SF45 Serial not working on fmu-v6x
3 participants