Skip to content
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

Block incorrect raw timestamp #3123

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

Navid200
Copy link
Collaborator

@Navid200 Navid200 commented Oct 9, 2023

After a hard reset, the raw timestamp is incorrect until after sensor start.
With the incorrect timestamp, the corresponding activation time is incorrect resulting in the transmitter days parameter to be reported as -1.
As long as transmitter days is -1, xDrip refuses to start sensor.
This creates a catch-22 situation as reported here: #3078.

This PR does not allow an incorrect raw timestamp to be used to update the transmitter age.
Tests show that the catch-22 situation is avoided after this PR.

@Navid200
Copy link
Collaborator Author

This has been tested.

@jamorham
Copy link
Collaborator

Can you elaborate on what sort of raw timestamp is being seen during this condition? I'm not sure if this is the best way to deal with this without knowing what the condition is.

@Navid200
Copy link
Collaborator Author

Navid200 commented Oct 11, 2023

Currently, xDrip sees a raw timestamp of 17 years. When it sees that, it refuses to enquire for a native timestamp. Without one, it returns -1 for transmitter days. With -1, it refuses to start a sensor.

After this, when xDrip sees a raw timestamp greater than 10 months (300 days), it ignores it and replaces it with 0.
I am happy to change that to 600. But, I don't think any battery currently lasts 10 months.

With a 0 raw timestamp, xDrip goes ahead and asks for the native timestamp. Unless the transmitter is really broken, it should get 0. With 0 as transmitter days, xDrip allows a sensor start.

The following is cosmetic.
When the raw timestamp becomes 0, xDrip stops showing it on the status page. So, the user will only see 0.
When the raw timestamp grows to something like 0.1. The user will see 0/0.1 for transmitter days on the status page.

The only new added log is a detail log stating that we are ignoring an incoming timestamp, which we believe is invalid.

I hope I did not misunderstand the question.

@Navid200
Copy link
Collaborator Author

The raw timestamp sent after a hard reset is 6214 days (7 years).

@Navid200
Copy link
Collaborator Author

Let me be the devil's advocate:

Let's say someone solders wires to the battery contacts and wires them to a power supply such that in 7 years the transmitter is still running.
At that point, after this PR, the raw timestamp will be switched to 0. But, the native timestamp will show 6214.
But, as soon as transmitter days goes over 180 days, my understanding is that the transmitter will refuse to start a session.
I don't see the point of such an experiment.
Regardless, in 7 years, I don't think G6 will still be as popular as it is today.

@jamorham jamorham merged commit 9e2f910 into NightscoutFoundation:master Oct 17, 2023
1 check passed
@Navid200 Navid200 deleted the Navid_2023_10_05 branch October 17, 2023 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants