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

AP_RangeFinder: Maxbotix sonar I2C multi devices #14079

Conversation

DomenicoPatella
Copy link

Add a backend driver for each maxbotix I2C rangefinder as different address.

Tested with two gy-us42 sonar , one of default address 0x70 and the second with 0x68 address

Maxbotix_i2c

Add a backend driver for each rangefinder as different address
@rmackay9
Copy link
Contributor

@DomenicoPatella. thanks for this. I guess though that during testing you needed to set the RNGFNDx_ADDR parameter even when using the default I2C address? I think we need a bit of code added to the MaxbotixI2C class that uses the default I2C address is the RNGFNDx_ADDR parameter is zero.

@DomenicoPatella
Copy link
Author

I suggest to check the RNGFNDx_ADDR > 0 before to assign the driver

 if(params[instance].address){
        FOREACH_I2C(i) {
          ...

In this case only the device with a valid address will be initialized.
There is no way to change the address for Maxbotix sensor, in this case we can do it
Otherwise we can write a default address only if user leave zero on address parameter

@peterbarker
Copy link
Contributor

This has been in a slightly different way in master which preserves existing behaviour (as @DomenicoPatella suggested, actually).

Thanks for this PR!

@peterbarker peterbarker closed this Feb 4, 2021
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.

None yet

3 participants