diff options
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/extras/mpu9250.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/klippy/extras/mpu9250.py b/klippy/extras/mpu9250.py index c588eaf0..419207fc 100644 --- a/klippy/extras/mpu9250.py +++ b/klippy/extras/mpu9250.py @@ -9,8 +9,16 @@ from . import bus, motion_report, adxl345 MPU9250_ADDR = 0x68 -MPU9250_DEV_ID = 0x73 -MPU6050_DEV_ID = 0x68 +MPU_DEV_IDS = { + 0x74: "mpu-9515", + 0x73: "mpu-9255", + 0x71: "mpu-9250", + 0x70: "mpu-6500", + 0x68: "mpu-6050", + #everything above are normal MPU IDs + 0x75: "mpu-unknown (DEFECTIVE! USE WITH CAUTION!)", + 0x69: "mpu-unknown (DEFECTIVE! USE WITH CAUTION!)", + } # MPU9250 registers REG_DEVID = 0x75 @@ -189,12 +197,14 @@ class MPU9250: # In case of miswiring, testing MPU9250 device ID prevents treating # noise or wrong signal as a correctly initialized device dev_id = self.read_reg(REG_DEVID) - if dev_id != MPU9250_DEV_ID and dev_id != MPU6050_DEV_ID: + if dev_id not in MPU_DEV_IDS.keys(): raise self.printer.command_error( - "Invalid mpu9250/mpu6050 id (got %x).\n" + "Invalid mpu id (got %x).\n" "This is generally indicative of connection problems\n" "(e.g. faulty wiring) or a faulty chip." % (dev_id)) + else: + logging.info("Found %s with id %x"% (MPU_DEV_IDS[dev_id], dev_id)) # Setup chip in requested query rate self.set_reg(REG_PWR_MGMT_1, SET_PWR_MGMT_1_WAKE) self.set_reg(REG_PWR_MGMT_2, SET_PWR_MGMT_2_ACCEL_ON) |