nightscout / Trio

MIT License
45 stars 125 forks source link

Eventual BG with 1 decimal in the app and in the watch app #320

Closed bjornoleh closed 44 minutes ago

bjornoleh commented 2 weeks ago

Resolves #319

bjornoleh commented 2 weeks ago

Eventual BG as presented with this patch:

52,8 mmol/L to the left, 951 mg/dL to the right (random numbers from sim phone/watch/CGM and pump) image

mountrcg commented 1 week ago

@bjornoleh there is a glucoseformatter also in ./FreeAPS/Sources/Modules/Home/View/Header/CurrentGlucoseView.swift which should fit perfectly for this issue

bjornoleh commented 1 week ago

CurrentGlucoseView

Thanks for looking! That is in another file, right? I don't think that glucoseFormatter will be accessible here. But I suppose my solution is a minimal and acceptable change, isn't it?

mountrcg commented 1 week ago

But I suppose my solution is a minimal and acceptable change, isn't it?

Totally!

As per discussion of targets and rounding errors leading to changed targets after multiple unit switches, I suspect that using https://github.com/nightscout/Trio/blob/20ba334b2c3b62ba296e67695bc015c4e5c868d4/FreeAPS/Sources/Modules/Home/View/Header/CurrentGlucoseView.swift#L13 would not lead to these. I think @polscm32 already centralized all formatters in Helpers at one point in some branch, which I guess is something we should also do. It only popped into my mind when viewing this PR as there are some inconsistencies in how rT.variables are handed over from oref to swift. Some are "convert_bg functioned" some always in md/dL - I think I am partly responsible for that and started fixing it, so I stumbled across glucoseformatter just this week.

bjornoleh commented 1 week ago

@mountrcg , perhaps you can write up an issue about this for later?