Hello @Shipbrook
M5Unified uses Wire1 for internal I2C and Wire for external I2C.
The example for SHT40 incorrectly uses Wire which causes issues as soon as other internal I2C communication is required, e.g. reading battery status.
The quick way to fix this is replacing Wire with Wire1 in below line:
//if(!sht4.begin(&Wire, SHT40_I2C_ADDR_44, SHT_SDA_PIN, SHT_SCL_PIN, 400000U))
if(!sht4.begin(&Wire1, SHT40_I2C_ADDR_44, SHT_SDA_PIN, SHT_SCL_PIN, 400000U))
The better way is to get the actual port used by M5Unified for internal I2C and the use that information:
i2c_port_t PortIn = M5.In_I2C.getPort();
TwoWire * WireIn = (PortIn == 1) ? &Wire1 : &Wire;
if(!sht4.begin(WireIn, SHT40_I2C_ADDR_44, SHT_SDA_PIN, SHT_SCL_PIN, 400000U))
Thanks
Felix