Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions core/frontend/src/utils/deviceid_decoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ enum COMPASS_TYPE {
MMC5883 = 0x13,
AK09918 = 0x14,
AK09915 = 0x15,
QMC5883P = 0x16,
BMM350 = 0x17,
IIS2MDC = 0x18,
LIS2MDL = 0x19,
}

enum IMU_TYPE {
Expand Down Expand Up @@ -69,6 +73,10 @@ enum IMU_TYPE {
INS_BMI270 = 0x38,
INS_BMI085 = 0x39,
INS_ICM42670 = 0x3A,
INS_ICM45686 = 0x3B,
INS_SCHA63T = 0x3C,
INS_IIM42653 = 0x3D,
INS_LSM6DSV = 0x3E,
}

enum BARO_TYPE {
Expand Down
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