Recent

Author Topic: Help with diabetes project  (Read 508 times)

slicke

  • New Member
  • *
  • Posts: 15
Help with diabetes project
« on: February 07, 2026, 12:18:28 am »
Hi!

I have type 1 diabetes and have made an app, Trndi, that displays your blood sugar levels + a trend graph based off remote APIs such as Dexcom/NightScout/Tandem. It also does JavaScript extensions (with the help of mORMot2, shoutout!).

I have about 40 users now, but I have a problem!

When the last 2 most recent readings are missing from Dexcom (not NightSocut), the "minutes ago" label and the trend graph goes away! I've dug down trying to find the rror, used AI even but no results!

Maybe one of you here have use of the app and would like to try helping me :) - https://github.com/slicke/trndi2

Thanks!

Boleeman

  • Hero Member
  • *****
  • Posts: 1118
Re: Help with diabetes project
« Reply #1 on: February 07, 2026, 02:30:50 am »
Hi Björn (slicke).

My own father had diabetes years ago (since passed away) so it's nice to see this sort of app. that measures blood sugar levels (as I had to did it manually every day with the old pin prick method).

I looked at your Github source and noticed that you had a 10 element fixed array for the TrendDots (dotArray: array[1..NUM_DOTS] of ^TDotControl;) and you also mentioned "When the last 2 most recent readings are missing". In my own graphics programs I noticed if I mix fixed arrays with dynamic arrays, there can be a misalignment of index values causing missing values and erratic behavior like missing pixels/etc. Are you able to work out why the 2 most recent readings are missing?

Also noticed you use 10 timers and a buffer ( const
MIN_REFRESH_INTERVAL_MS = 120000; // 2 minutes
REFRESH_RESYNC_BUFFER_MS = 15000;, reading := lastReading;,   intervalMs := min(BG_REFRESH, BG_REFRESH - (secondsSinceLast * 1000));
  // 5 min or less if there's a recent reading
  intervalMs := max(MIN_REFRESH_INTERVAL_MS, intervalMs); // Don't allow too small refresh time (min 2 minutes)
  tMain.Interval := intervalMs + REFRESH_RESYNC_BUFFER_MS;)  so maybe refresh buffer/timers are mis-aligned or the Timer intervals are off a bit so some readings are not synced and become missing?

I will need to install Mormot2 to see your app in action.

Maybe I am way off, but when you mentioned "last 2 most recent readings are missing" it sort of reminded me of similar faults I was seeing in my own graphics programs when I mixed fixed arrays with dynamic arrays (most times I try to just use dynamic arrays to keep the index values consistent). Fixed arrays (1 based) and Dynamic arrays (0 based).
« Last Edit: February 07, 2026, 02:44:30 am by Boleeman »

slicke

  • New Member
  • *
  • Posts: 15
Re: Help with diabetes project
« Reply #2 on: February 07, 2026, 12:13:28 pm »
Thanks for your answer!

I'm going to try and adapt my debug driver for missing readings and see if I can reproduce the error that way. Insted of testing the live driver (which I'm doing now).

 

TinyPortal © 2005-2018