ooflet / Mi-Create

Unofficial watchface creator for Xiaomi wearables ~2021 and above
https://ooflet.github.io/docs
GNU General Public License v3.0
34 stars 4 forks source link

Minimum and maximum temperature widgets #1

Closed Kosmadeo closed 3 months ago

Kosmadeo commented 7 months ago

Can you please add minimum and maximum temperature widgets? (what was it like in Miband 7,6,5?)

ooflet commented 7 months ago

Looking into it. There should be a data source for min/max weather however I'm not entirely sure.

Kosmadeo commented 7 months ago

If it was possible, I would very much like it. I use temp min and temp max to display my blood glucose levels (I am diabetic). It works great on miband 4,5,6,7; so I would like to have this option on Miband 8. I use Juggluco->Gadgetbridge->Miband 7

Thank you in advance.

Chriz76 commented 5 months ago

At least the weather widget shows the min and max values. @ooflet how can we find out what datasources are supported for the watch faces and what happens if an unsupported number is choosen. Will it crash on the band or just display an empty value?

ooflet commented 5 months ago

@Chriz76 From my experience with the band, it will display an empty value. I do not have access to a band right now, so I cannot test further. dataSrc_list.txt contains a list of data sources in hex, which needs to be converted to decimal to work, however its strangely not a simple process of converting hex to decimal. There is a process to convert this to a decimal format that the compiler will work with, but I do not get how it works.

Mi Create supports data sources in DeviceInfo.db as hex but the compiler currently does not. I will look into it with the compiler maintainer to get hex codes supported.

Chriz76 commented 5 months ago

Thank you @ooflet . The list looks promissing and I will try it. Why do you think the hex values have to be converted to decimal? I checked the code and it looks as if it is used as it is. Then I checked the bin file and also found the hex values at the right places.

This is how a widget gets decoded ("shape" is also part of the datasource):

new FaceWidget()
                    {
                        RawData = bin,
                        Shape = bin[0],
                        DataSrcDisplay = bin[1],
                        X = bin.Length >= 0x20 ? bin.GetWord(0x14) : 0,
                        Y = bin.Length >= 0x20 ? bin.GetWord(0x16) : 0,
                        Width = 0,
                        Height = 0,
                        Id = id,
                        Digits = digits,
                        Align = (byte)(bin[3] & 0x03),
                        TypeId = bin[3] >> 4,
                        TargetId = bin.GetDWord(0x08)
                    }
ooflet commented 5 months ago

@Chriz76 This is for compatibility with legacy software (EasyFace) because it only allows for decimal source ids

Chriz76 commented 5 months ago

I verified that the Min Max temperature ids are working on mi band 8. You may have to switch digits positions from 1234 to 3412.

https://github.com/ooflet/Mi-Create/issues/1

Unsupported sources just show 0 and don't crash the band.