Skip to content

Conversation

@peterbarker
Copy link
Contributor

we're indexing into the sensors array, so we should only iterate up to the number of sensors we have

could be a problem if there are DroneCAN backends involved as that can cause a mismatch between _num_sensors and _num_drivers

/*
wrapper around hal.i2c_mgr->get_device() that prevents duplicate devices being opened
*/
bool AP_Baro::_have_i2c_driver(uint8_t bus, uint8_t address) const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason this might have occurred is the bad naming of this method, I think you should change it to _have_i2c_device as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #31845 where all of the inevitable bike-sheeding can occur.

I'd rather not hold this up for that no-compiler-output change.

@peterbarker peterbarker requested a review from andyp1per January 3, 2026 01:44
we're indexing into the sensors array, so we should only iterate up to the number of sensors we have

could be a problem if there are DroneCAN backends involved as that can cause a mismatch between _num_sensors and _num_drivers
@peterbarker peterbarker force-pushed the pr/baro-iteration-count-wrong branch from 3b65760 to 46ec569 Compare January 4, 2026 02:37
@peterbarker peterbarker moved this to ReadyForDevCall in Peter's ArduPilot 4.7 Queue Jan 5, 2026
@andyp1per andyp1per merged commit 8384ec1 into ArduPilot:master Jan 6, 2026
117 of 118 checks passed
@github-project-automation github-project-automation bot moved this from ReadyForDevCall to Done in Peter's ArduPilot 4.7 Queue Jan 6, 2026
@peterbarker peterbarker deleted the pr/baro-iteration-count-wrong branch January 7, 2026 00:46
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.

2 participants