AP_Rangefinder: preserve new address

This commit is contained in:
Mohammad Hefny 2022-04-25 07:31:24 +02:00 committed by Andrew Tridgell
parent 599cd15c7b
commit ce8405b7a4
1 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,11 @@ bool AP_RangeFinder_VL53L1X::check_id(void)
} }
bool AP_RangeFinder_VL53L1X::reset(void) { bool AP_RangeFinder_VL53L1X::reset(void) {
if (dev->get_bus_id()!=0x29) {
// if sensor is on a different port than the default do not reset sensor otherwise we will lose the addess.
// we assume it is already confirgured.
return true;
}
if (!write_register(SOFT_RESET, 0x00)) { if (!write_register(SOFT_RESET, 0x00)) {
return false; return false;
} }