-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rapid Reconnect Transition mode #3829
base: master
Are you sure you want to change the base?
Conversation
@jamorham I'm sorry about the long description. |
I cannot recreate the problem with my Pixel. Edit: I wanted to demonstrate the problem with an active device that was still younger than 10 days. But, it does not happen with every G7. |
Thanks for the very detailed PR. I will have to study it in some detail because making changes to the timing aspect is a very significant change which has to be handled really well. I appreciate there are some inconsistencies already and it is definitely worth a closer look to see if things can be improved but equally I don't find consistent behavior from the transmitter side which makes testing harder. |
Before and after for a fully functional G7:
|
Thanks I hope I have not misunderstood the comment about testing challenge. Now that I have that, I know the rapid reconnect timings will be 00:3:50, 00:04:50, 00:05:50 and 00:06:50. Of course, there are another 4 at 00:08:50 ... I install xDrip on the test phone and keep collection disabled during all scans. Each scan lasts about 17 seconds. |
This PR makes the user experience with G7 and xDrip consistent regardless of the random nature caused by the G7 Rapid Reconnect function:
What activates Rapid Reconnect Transition mode?
It is automatically activated when xDrip pairs with a G7.
I refer to this in the logs as the first Rapid Reconnect Transition mode handshake.
What happens in Rapid Reconnect Transition mode?
xDrip wakes once a minute.
The Hunting Transmitter note is shown on the Dex status page after pair approval until a subsequent handshake regardless of any event.
Subsequent to the pair request approval, after xDrip completes another handshake, scan always mode is activated.
No brain status error is shown on the Dex status page.
What disables Rapid Reconnect Transition mode?
When either one of the following two conditions is satisfied, the Rapid Reconnect Transition mode is disabled.
1- Two handshakes subsequent to the pair request approval handshake
2- 10 minutes after pair request approval
Could it fail?
If the user walks away from the phone after pairing before two subsequent handshakes, the intended process will not complete.
But, the user can just wait for xDrip to do its job. Alternatively, the user can forget the device from the Bluetooth list and temporarily change the transmitter ID and wait for a pair request for the Rapid Reconnect Transition mode to activate again.
Test
The following tests were performed on an Android 11 Motorola Stylus phone.
Before every test, xDrip was uninstalled and all devices starting with DXCM were deleted from the Bluetooth list.
Then, the version under test was installed. Then, xDrip battery optimization was disabled. After that, source wizard was used to choose G7, background location access was granted, and the pairing code was entered.
For both tests, the transmitter was disconnected more than 15 minutes prior and it was confirmed that it was transmitting once a minute.
For both tests, it was arranged for pairing to occur one 1-minute cycle before the 5-minute cycle transmission.
For both tests, collection was enabled about 30 seconds before the transmission cycle start.
Screens recordings in the following table are sped up by a factor of 16.
If the user waits patiently for several read cycles for xDrip to enable always scan mode, it will eventually discover the correct time grid.
The problem is that many users will intervene thinking that something is wrong considering the possibility of the error message and the longer periods of time with no connectivity. So, they restart the phone or restart collector etc. Sometimes, these will succeed.
The guide asks the user to read this: https://navid200.github.io/xDrip/docs/Dexcom/G7OnceAMinuteScan.html
If user follows those instructions, the outcome will be identical to what this PR does.
The problem is that you cannot expect everyone to read all the pages of the guide.
This PR does the right thing with no need for any human intervention other than keeping the old sensors away and staying with the phone for up to 10 minutes after pairing.
This PR ensures connectivity as fast as possible taking into account everything that could possibly go wrong.