xdripswift icon indicating copy to clipboard operation
xdripswift copied to clipboard

Only store CGM address to user defaults when app is set as "Active CGM", and fix typo in "CGM"

Open bjornoleh opened this issue 2 years ago • 6 comments

bjornoleh avatar Nov 21 '22 21:11 bjornoleh

The intention with this commit is to avoid having the app set as "inactive CGM" (setActiveCGM = off) to store the wrong CGM transmitter address to shared user defaults, which will break the Heartbeat mechanism for FreeAPS X. This is in the context of using two instances of xdrip4iOS when running overlapping sensor sessions with Anubis G6.

I am not sure if this will work as intended, but at least it builds.

bjornoleh avatar Nov 24 '22 17:11 bjornoleh

there is already an option "Suppress Loop Share" in the developer settings, that suppress also setting the cgm transmitter address see https://github.com/JohanDegraeve/xdripswift/blob/ab1b5b9b72ab35aa00389e91c1196bc540fd9146/xdrip/Managers/BluetoothPeripheral/BluetoothPeripheralManager.swift#L54

JohanDegraeve avatar Nov 27 '22 17:11 JohanDegraeve

there is already an option "Suppress Loop Share" in the developer settings, that suppress also setting the cgm transmitter address see

https://github.com/JohanDegraeve/xdripswift/blob/ab1b5b9b72ab35aa00389e91c1196bc540fd9146/xdrip/Managers/BluetoothPeripheral/BluetoothPeripheralManager.swift#L54

Oh, I didn’t realise, thanks! Then this should probably be tied to the “Set as active CGM” setting then. Suppress loop share = off when active CGM is on, suppress loop share = on when active CGM is off?

bjornoleh avatar Nov 27 '22 17:11 bjornoleh

there is already an option "Suppress Loop Share" in the developer settings, that suppress also setting the cgm transmitter address see https://github.com/JohanDegraeve/xdripswift/blob/ab1b5b9b72ab35aa00389e91c1196bc540fd9146/xdrip/Managers/BluetoothPeripheral/BluetoothPeripheralManager.swift#L54

Oh, I didn’t realise, thanks! Then this should probably be tied to the “Set as active CGM” setting then. Suppress loop share = off when active CGM is on, suppress loop share = on when active CGM is off?

yes it would be better to set suppressLoopShare accordingly

JohanDegraeve avatar Nov 27 '22 18:11 JohanDegraeve

@JohanDegraeve , I think I have set suppressLooppShare correctly now, please see https://github.com/bjornoleh/xdripswift/commit/951a454101ba7ef30184d1b075f2c7edf79ba67f

bjornoleh avatar Nov 30 '22 12:11 bjornoleh

This change removes the risk of accidentally breaking the heartbeat mechanism by opening the wrong app. But it is still required to force close and reopen the app to guarantee that the transmitter address is written to shared user defaults ( the last opened app will write its transmitter address upon start). Would it be possible to force the current app to write the transmitter address when we switch on SetActiveCGM, without a restar of the app?

bjornoleh avatar Dec 01 '22 08:12 bjornoleh