MrJordanRoth / NS2Win

Rainmeter skin to display your Nightscout glucose on your Windows device using Rainmeter.
The Unlicense
4 stars 2 forks source link

[meterGlucoseDelta] adding "+" for positive Delta values #13

Closed emp-00 closed 2 years ago

emp-00 commented 2 years ago

Improvement suggestion: Currently, negative delta values (e.g. -4 mg/dl) are shown with the minus sign (and colored red). That's fine. What I'm missing is a leading "+" sign (e.g. +4 mg/dl) for delta values >0.

I think these are the decisive code sections, but all my attempts to add a "+" (only) for positive values have failed so far. Maybe just one additional IfCondition3 but how does the code look like for adding the leading "+" to the MeasureGlucoseDelta-String?

**[MeasureGlucoseDelta] Measure=WebParser URL=[MeasureSite] StringIndex=6 IfCondition=MeasureGlucoseDelta < 0 IfTrueAction=[!SetOption MeterGlucoseDelta FontColor 220,20,60] IfCondition2=MeasureGlucoseDelta > 0 IfTrueAction2=[!SetOption MeterGlucoseDelta FontColor 125,252,0]

[meterGlucoseDelta] Meter=String MeterStyle=styleLeftText MeasureName=MeasureBG X=84 Y=23 W=56 H=22 Text=[&MeasureGlucoseDelta] DynamicVariables=1**

FYI - I have made some small cosmetic changes, formatting the [&MeasureGlucose] value with RIGHT alignment and shifting the delta and arrows to the right side along with slightly larger font size. Additionally I made a dark and only slightly transparent background which gives much better readability especially for light backgrounds, e.g. snow photographs. This is how my modified gadget looks like -> if there would be "+" in front of the "4" I'd be 100% happy :-)

image

Thanks for helping and giving inspiration guidance with your NS2Win gadget. It's really a smart tool running every day on my desktop computers.

MrJordanRoth commented 2 years ago

Thanks, @emp-00, the changes you made look great. I will look at adding the + code for deltas that are going higher. I've left it out to save space.

emp-00 commented 2 years ago

@MrJordanRoth : I saw your posting and the reply from SilverAzide @forum.rainmeter.net - many thanks for asking this. SilverAzide's solution works perfectly for me: https://forum.rainmeter.net/viewtopic.php?p=210484#p210484

image

One "last question", as you can see in this case +12 mg/dl but the trend arrow is "Flat" (-->) - do you know why? I have checked the output of the pebble api actually returns "Flat" most of the time. Very rarely it shows a 45up/down and in my case I have never seen a doubleup/down arrow. Do you know why? Even looking at the last 3-value-average a "Flat" arrow does not really make sense here in this example since I was coming from a "LOW" bg and going straight up in the last 4 readings (due to eating glucose ;-). I think we could add code to calculate our own trend arrow based e.g. on the last 3 values for example like xDrip+ is doing this. But I really wonder why the pebble api does not return a more appropriate trend arrow... Seems like a bug to me?

Next reading -> still "Flat" despite another +7 mg/dl ... image

Definitely this is not a bug of NS2Win, here's the api output: image

image

MrJordanRoth commented 2 years ago

@em, thats great. I was able to ask them but I wasn't actually able to try it.

As for the trend arrow mine seems to be working. What version is your NS? How are you getting your Dexcom data to it?

emp-00 commented 2 years ago

@MrJordanRoth : nightscout version 14.2.5 and Dexcom data is uploaded via xDrip+ REST-API

Here's the nightscout api output via https://[SERVER-URL]/api/v1/entries?token=[TOKEN] "2022-10-08T14:20:33.088Z" 1665238833088 115 "Flat" "xDrip-DexcomG5 G6 Native" "2022-10-08T14:15:33.142Z" 1665238533142 123 "Flat" "xDrip-DexcomG5 G6 Native" "2022-10-08T14:10:33.113Z" 1665238233113 129 "FortyFiveUp" "xDrip-DexcomG5 G6 Native" "2022-10-08T14:05:33.128Z" 1665237933128 123 "FortyFiveUp" "xDrip-DexcomG5 G6 Native" "2022-10-08T14:00:32.986Z" 1665237632986 116 "FortyFiveUp" "xDrip-DexcomG5 G6 Native" "2022-10-08T13:55:32.964Z" 1665237332964 107 "Flat" "xDrip-DexcomG5 G6 Native" "2022-10-08T13:50:33.122Z" 1665237033122 92 "Flat" "xDrip-DexcomG5 G6 Native" "2022-10-08T13:45:33.063Z" 1665236733063 89 "Flat" "xDrip-DexcomG5 G6 Native" "2022-10-08T13:40:33.088Z" 1665236433088 93 "Flat" "xDrip-DexcomG5 G6 Native" "2022-10-08T13:35:33.361Z" 1665236133361 91 "Flat" "xDrip-DexcomG5 G6 Native"

image

MrJordanRoth commented 2 years ago

@emp-00, I'm checking my NS and my NS2Win display and they match exactly. Do your NS data show the arrows matching as your display?

image

emp-00 commented 2 years ago

@MrJordanRoth : Yes, the NS server already shows the "wrong" trend arrows in my case... I already tried to find information how to fix this but I can only switch the NS plugin "direction" on or off. There seem to be no configuration options... It's definitely not a problem from the NS2Win skin - it's already "wrong" on the server. Currently, I'm lost, no idea how to tackle :-(

MrJordanRoth commented 2 years ago

Yeah, then it would have to be on the NS side. We are just pulling the information from NS API. I know where was some known issues with Trends but it was fixed in a prior version.

emp-00 commented 2 years ago

Update: I have consulted "CGM in the cloud" - they claim that it cannot be nightscout. The trend arrow "direction string" comes from the uploading device and is not calculated by nightscout. Therefore, in my case, xDrip+ obviously must be responsible. I'm currently discussing this with the xDrip+ team.

emp-00 commented 2 years ago

You can also close this one, it's clearly not a problem of the NS2Win code. The xDrip team is aware of this now and (hopefully) they will find the time to look at this ...