pvvx / ATC_MiThermometer

Custom firmware for the Xiaomi Thermometers and Telink Flasher
https://github.com/pvvx/pvvx.github.io/tree/master/ATC_MiThermometer
Other
2.75k stars 196 forks source link

Switching to v4.6 changes hardware revision from B2.0 to B1.7 #479

Open doolbneerg opened 4 months ago

doolbneerg commented 4 months ago

I got a couple new LYWSD03MMC thermometers. I went to put the custom firmware on them and saw that there was a new v4.6. When I first connected to it, I was told that they were Hardware Revision B2.0. However, after flashing to v4.6 it is now saying B1.7. I went back and checked some of my older devices on v3.8 and they are showing the correct B2.0 hardware revision. And when I updated one of those to v4.6, it also starts showing B1.7.

Is this expected? Looking through the code, it looks like you are attempting to keep the original hardware revision. Flashing back to the original firmware correctly shows B2.0 again.

What if any diagnostics can I do to understand why this is happening?

pvvx commented 4 months ago
HW LCD I2C addr SHTxxx I2C addr Note
B1.4 0x3C 0x70 (SHTC3)  
B1.5 UART! 0x70 (SHTC3)  
B1.6 UART! 0x44 (SHT4x)  
B1.7 0x3C 0x44 (SHT4x) Test original string HW
B1.9 0x3E 0x44 (SHT4x)  
B2.0 0x3C 0x44 (SHT4x) Test original string HW

Version 1.7 or 2.0 is determined at first run by reading the HW line written in Flash. Display matrices or controllers are different for all versions, except B1.7 = B2.0.

Hardware version B1.7 is no different from B2.0. It is impossible to determine programmatically.

The Flash area where the version number for Xiaomi was recorded is used to record history and is erased at the first start. It is stored in another place, but this can also be erased, since the HW variant is determined by hardware properties.