-
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
Add predicted iob data to broadcastservice #2294
Merged
jamorham
merged 8 commits into
NightscoutFoundation:master
from
bigdigital:add_simulated_iob_to_broadcastservice
Mar 28, 2023
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f6c08cf
allow to send predicted data (IOB, BWP)
bigdigital deb66bb
reset predicted iob before data refresh
bigdigital 48068a9
Merge branch 'master_upstream' into add_simulated_iob_to_broadcastser…
bigdigital 990fe51
add cancel_alarm not notify remote devices in case alert were stopped…
bigdigital 5b3e5b0
Merge branch 'master_upstream' into add_simulated_iob_to_broadcastser…
bigdigital 457dd65
add external status line in extra key as string + timeStamp
bigdigital a24b8b9
Merge branch 'master_upstream' into add_simulated_iob_to_broadcastser…
bigdigital bb52610
use keystore to achieve predicted iob and bwp
bigdigital File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this always sets the variables to an empty string which does not change till line 569. Maybe you should initialize the strings to
""
in line 84/85?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a place where the variable resets in case if the iob data would not be updated in BgGraphBuilder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in case if settings.isDisplayGraph() is false, the predictedIOB and predictedBWP always would be empty. Maybe it would be better to transfer iob only if graph is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only location where
predictedIOB
andpredictedBWP
are set to likely non-empty value is in thestatusReceiver
onReceive
event. The next use isbundle.putString("predict.IOB", predictedIOB);
but right before the if condition these two variables will be emptied. Hence, an empty string is always passed tobundle.putString
. That's my main concern. Did I oversee anything?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. the variables are filled via statusReceiver by receiving the broadcast messages. And those broadcast messages can be triggered by
bgGraphBuilder.defaultLines(false)
function which calls addBgReadingValues(simple) and the last one function callsHome.updateStatusLine("iob", df.format(iob.iob))
. So when the code reaches to thebundle.putString
, the iob and wpb values would be filled with the valid data.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tolot27 as i understand this pr was stuck because the "bwp" and "iob" broadcast data which is generated in BgGraphBuilder transfers with help of sendBroadcast finction which is runs asynchronously. Maybe to resolve this problem we can change sendBroadcast in updateStatusLine to sendBroadcastSync which should block the execution of the thread .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using the keystore data like is done with
bwp_last_insulin
inPebbleDisplayTrend
? I could easily add more keystore fields if this doesn't include everything needed. Then you don't need to worry about asynchronous broadcasts.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I guess this should help to transfer data across different parts of the application. It is enough to add bwp_update data (but maybe better to divide the current string inot two separate variables with the carb and insulin info). And a separate keystore for "iob" which is declared by this line
Home.updateStatusLine("iob", df.format(iob.iob));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added both, let me know if this helps: 094b09c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Now works fine, added appropriate code changes