Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ardupilot manager: allow either ak09915 or IIS2MDC compasses for navi…
…gator
  • Loading branch information
Williangalvani committed Apr 23, 2026
commit 5800689e2356f11996910bc5d2883515bb061339
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ def get_serials(self) -> List[Serial]:


class NavigatorPi5(Navigator):
devices = {
required_devices = {
"ADS1115": (0x48, 1),
"AK09915": (0x0C, 1),
"BME280": (0x76, 1),
"PCA9685": (0x40, 3),
}

magnetometer_devices = {
"AK09915": (0x0C, 1),
"IIS2MDC_0x1E": (0x1E, 1),
}

def get_serials(self) -> List[Serial]:
return [
Serial(port="C", endpoint="/dev/ttyAMA0"),
Expand All @@ -52,17 +56,25 @@ def get_serials(self) -> List[Serial]:
def detect(self) -> bool:
if not get_cpu_type() == CpuType.PI5:
return False
return all(self.check_for_i2c_device(bus, address) for address, bus in self.devices.values())
required_ok = all(self.check_for_i2c_device(bus, address) for address, bus in self.required_devices.values())
magnetometer_ok = any(
self.check_for_i2c_device(bus, address) for address, bus in self.magnetometer_devices.values()
)
return required_ok and magnetometer_ok


class NavigatorPi4(Navigator):
devices = {
required_devices = {
"ADS1115": (0x48, 1),
"AK09915": (0x0C, 1),
"BME280": (0x76, 1),
"PCA9685": (0x40, 4),
}

magnetometer_devices = {
"AK09915": (0x0C, 1),
"IIS2MDC_0x1E": (0x1E, 1),
}

def get_serials(self) -> List[Serial]:
release = "Bullseye"
os_release = load_file("/etc/os-release")
Expand All @@ -89,4 +101,8 @@ def get_serials(self) -> List[Serial]:
def detect(self) -> bool:
if not get_cpu_type() == CpuType.PI4:
return False
return all(self.check_for_i2c_device(bus, address) for address, bus in self.devices.values())
required_ok = all(self.check_for_i2c_device(bus, address) for address, bus in self.required_devices.values())
magnetometer_ok = any(
self.check_for_i2c_device(bus, address) for address, bus in self.magnetometer_devices.values()
)
return required_ok and magnetometer_ok
Loading