sensord: reset LSM (#35872)
* sensord: reset LSM * they'll be ready in time * switch to SW_RESET, BOOT not working for some reason
This commit is contained in:
@@ -98,6 +98,13 @@ def main() -> None:
|
||||
(MMC5603NJ_Magn(I2C_BUS_IMU), "magnetometer", False),
|
||||
]
|
||||
|
||||
# Reset sensors
|
||||
for sensor, _, _ in sensors_cfg:
|
||||
try:
|
||||
sensor.reset()
|
||||
except Exception:
|
||||
cloudlog.exception(f"Error initializing {sensor} sensor")
|
||||
|
||||
# Initialize sensors
|
||||
exit_event = threading.Event()
|
||||
threads = [
|
||||
|
||||
@@ -40,6 +40,11 @@ class Sensor:
|
||||
def device_address(self) -> int:
|
||||
raise NotImplementedError
|
||||
|
||||
def reset(self) -> None:
|
||||
# optional.
|
||||
# not part of init due to shared registers
|
||||
pass
|
||||
|
||||
def init(self) -> None:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ class LSM6DS3_Accel(Sensor):
|
||||
def device_address(self) -> int:
|
||||
return 0x6A
|
||||
|
||||
def reset(self):
|
||||
self.write(0x12, 0x1)
|
||||
time.sleep(0.1)
|
||||
|
||||
def init(self):
|
||||
chip_id = self.verify_chip_id(0x0F, [0x69, 0x6A])
|
||||
if chip_id == 0x6A:
|
||||
|
||||
@@ -29,6 +29,10 @@ class LSM6DS3_Gyro(Sensor):
|
||||
def device_address(self) -> int:
|
||||
return 0x6A
|
||||
|
||||
def reset(self):
|
||||
self.write(0x12, 0x1)
|
||||
time.sleep(0.1)
|
||||
|
||||
def init(self):
|
||||
chip_id = self.verify_chip_id(0x0F, [0x69, 0x6A])
|
||||
if chip_id == 0x6A:
|
||||
|
||||
Reference in New Issue
Block a user