@@ -499,7 +499,18 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
499499 SCAN_SIMPLE_CASE (DFROBOT_RAIN_ADDR, DFROBOT_RAIN, " DFRobot Rain Gauge" , (uint8_t )addr.address );
500500 SCAN_SIMPLE_CASE (LTR390UV_ADDR, LTR390UV, " LTR390UV" , (uint8_t )addr.address );
501501 SCAN_SIMPLE_CASE (PCT2075_ADDR, PCT2075, " PCT2075" , (uint8_t )addr.address );
502- SCAN_SIMPLE_CASE (CST328_ADDR, CST328, " CST328" , (uint8_t )addr.address );
502+ case CST328_ADDR:
503+ // Do we have the CST328 or the CST226SE
504+ registerValue = getRegisterValue (ScanI2CTwoWire::RegisterLocation (addr, 0xAB ), 1 );
505+ if (registerValue == 0xA9 ) {
506+ type = CST226SE;
507+ logFoundDevice (" CST226SE" , (uint8_t )addr.address );
508+ } else {
509+ type = CST328;
510+ logFoundDevice (" CST328" , (uint8_t )addr.address );
511+ }
512+ break ;
513+
503514 SCAN_SIMPLE_CASE (CHSC6X_ADDR, CHSC6X, " CHSC6X" , (uint8_t )addr.address );
504515 case LTR553ALS_ADDR:
505516 registerValue = getRegisterValue (ScanI2CTwoWire::RegisterLocation (addr, 0x86 ), 1 ); // Part ID register
@@ -528,8 +539,12 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
528539#endif
529540
530541 case MLX90614_ADDR_DEF:
531- registerValue = getRegisterValue (ScanI2CTwoWire::RegisterLocation (addr, 0x0e ), 1 );
532- if (registerValue == 0x5a ) {
542+ // Do we have the MLX90614 or the MPR121KB or the CST226SE
543+ registerValue = getRegisterValue (ScanI2CTwoWire::RegisterLocation (addr, 0x06 ), 1 );
544+ if (registerValue == 0xAB ) {
545+ type = CST226SE;
546+ logFoundDevice (" CST226SE" , (uint8_t )addr.address );
547+ } else if (getRegisterValue (ScanI2CTwoWire::RegisterLocation (addr, 0x0e ), 1 ) == 0x5a ) {
533548 type = MLX90614;
534549 logFoundDevice (" MLX90614" , (uint8_t )addr.address );
535550 } else {
@@ -547,6 +562,11 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
547562 case ICM20948_ADDR: // same as BMX160_ADDR
548563 case ICM20948_ADDR_ALT: // same as MPU6050_ADDR
549564 registerValue = getRegisterValue (ScanI2CTwoWire::RegisterLocation (addr, 0x00 ), 1 );
565+ #ifdef HAS_ICM20948
566+ type = ICM20948;
567+ logFoundDevice (" ICM20948" , (uint8_t )addr.address );
568+ break ;
569+ #endif
550570 if (registerValue == 0xEA ) {
551571 type = ICM20948;
552572 logFoundDevice (" ICM20948" , (uint8_t )addr.address );
0 commit comments