Commit Graph

230 Commits

Author SHA1 Message Date
Paul Plant a9a3d1d487 dynamically set watch view to screen size
using WKInterfaceDevice.current().screenBounds.size the chart size is modified together with text sizes in all views in order to make sure the view renders nicely in small watches
2024-03-15 20:24:36 +01:00
Paul Plant 67b566cd9d heartbeat disconnect warning (in seconds) now specific to heartbeat type being used
- removed some heartbeat debugging
2024-03-15 18:50:02 +01:00
Paul Plant 866211b5fe watch chart change for 44mm. systemSmall iOS widget update 2024-03-13 22:16:44 +01:00
Paul Plant a7edde85b4 Merge branch 'develop' into watch-app-3 2024-03-12 14:59:01 +00:00
Paul Plant 3229a0e532 watch app improvements, follower mode data source, iOS widget improvements
- also widget data is stored in a new userDefaults variable based upon the app bundle to avoid cross-contamination if various versions are installed on the same device
2024-03-10 11:35:05 +01:00
Paul Plant 2929118301 added widget .accessoryRectangle + various improvements 2024-03-05 17:22:50 +01:00
Paul Plant d671e6ab0a WidgetKit implementation for Watch and xDrip targets 2024-03-04 20:04:07 +01:00
Paul Plant 214ab60ac8 update 240226 2024-02-26 18:10:53 +01:00
Johan Degraeve f631d54bd8 DexcomG7 companion mode
Identifies the Dexcom G7 without the need for filling in the device name. Requires that the official Dexcom App always runs in parallel.
2024-02-25 12:15:25 +01:00
Paul Plant da7b119ec2 update 240223 2024-02-23 12:02:24 +01:00
Paul Plant 007c8328ba update 240219 2024-02-19 20:22:20 +01:00
Paul Plant 26057fd272 refactoring and cleaning up
removed widget/watch specific/duplicated extensions, moved common data models to xDrip target and made sure targets are set correctly for all common files.
2024-02-14 19:59:53 +01:00
Paul Plant 0e51afe250 Merge branch 'develop' into watch-app 2024-02-13 22:16:52 +01:00
Johan Degraeve 89b03ec2ee Libre3 and/or Dexcom G7 and/or OmniPod as heartbeat
- Libre 3 or Dexcom G7 as heartbeat
  - Libre 3 as heartbeat: avoids the need for audioPlayer that keeps the app alive in the background. When Libre 3 sends data, xDrip4iOS will wake up and fetch a reading from LibreView
  - Dexcom G7 as heartbeat: only useful in combination with Loop. Loop must read the Dexcom G7 readings and upload to NightScout. xDrip4iOS will wake up when G7 sends data and will fetch the latest reading from NightScout. This occurs with a delay (Thread.sleep) of 1 second, to give time to loop to upload the reading to NightScout. Sometimes xDrip4iOS is still to early to fetch the reading. In that case, it may help to delete the heartbeat and recreate it.
  - OmniPod as heartbeat: for OmniPod users, this is a useful additional heartbeat. OmniPod has the interesting 'feature' to disconnect and reconnect every few minutes. Which allows to call the heartbeat function.
  - M5Stack as heartbeat: this is implemented as part of the M5Stack transmitter, it does not appear in the list of heartbeat devices. M5Stack will wake up xDrip4iOS if it didn't receive a reading from xDrip4iOS for more than 5 minutes. This allows xDrip4iOS to download the latest reading and send it to the M5Stack. Needs the latest release of M5stack or M5Stick-C software : https://github.com/JohanDegraeve/M5_NightscoutMon or https://github.com/JohanDegraeve/M5_StickC_xdrip_iOS

- the change required also to re-enable alarms, notifications, badge counter, ... when user has chosen followerBackgroundKeepAliveType disabled

- To use Libre 3 has heartbeat:
 - First connect to Libre 3 with official Libre 3 app
 - when connected, go to the iOS settings and read and note the name of the Libre (it's not something with ABBOTT in it, it's more like a random string)
 - force close the Libre 3 app
 - in xDrip4iOS, go to the bluetooth section
 - add a new transmitter of type HeartBeat
 - select Libre 3
 - as transmitter id, fill in the name you read in the iOS settings, just 4 or 5 characters is enough. It's case insensitive.
 - click the scan button. (you will not be asked to do NFC scan)
 - wait till connected
 - now reopen the official Libre 3 app

- To use Dexcom G7 as heartbeat:
 - make sure you connected at least once to the Dexcom G7 with the official Dexcom app and/or Loop.
 - Not necessary to force close other apps (like Official Dexcom G7 app and Loop)
 - go to the iOS settings and read and note the name of the Dexcom G7. It's case insensitive.
 - in xDrip4iOS, go to the bluetooth section
 - add a new transmitter of type HeartBeat
 - select Dexcom G7
 - as transmitter id, fill in the name you read in the iOS settings.
 - click the scan button. (you will not be asked to do NFC scan)
 - wait till connected

- To use OmniPod as heartbeat:
 - Force close any other app that connects to the OmniPod (that should only be Loop)
 -  - in xDrip4iOS, go to the bluetooth section
 - add a new transmitter of type HeartBeat
 - select OmniPod
 - click the scan button
 - wait till connected
 - you can now reopen Loop
2024-02-13 21:52:40 +01:00
Paul Plant cfc97aa94c basic layout implemented 2024-02-13 20:20:19 +01:00
Paul Plant bc7801d307 rename old WatchManager to CalendarManager. Add placeholder new WatchManager 2024-02-11 12:54:13 +01:00
Paul Plant 1f77bb89a9 glucose chart x-axis fix for only new values. trace file fixes 2024-02-05 12:34:48 -06:00
Paul Plant ebd5dc2335 update 2024-01-03 16:13:30 +01:00
MikePlante1 4cc8829c78 Change defaultBatteryAlertLevelDexcomG5 to 270 2023-12-28 13:38:50 -05:00
MikePlante1 95532c6692 Use VoltageB instead of VoltageA for Dexcom Transmitter Battery Alarms
Also change default alarm threshold to 260 (2600mV)
2023-12-28 12:42:27 -05:00
Paul Plant 14569b7bab update defaultTargetMarkInMgdl from 120 -> 100 2023-12-24 15:11:48 +01:00
Paul Plant aa2cadfdaa corrections to data source view processing
- code refactored to make it easier for future follower types to be added
- ensured double-tap only works if Nightscout URL is shown in the label
- separated "no sensor data" warning and shown in red
- removed keep-alive text label and outlets
2023-12-18 19:12:42 +01:00
Paul Plant 3880a33c2d add option to offset carb treatments in the BG chart
- added an option to offset the carb treatment markers above the glucose markers in the charts
- observer added to update chart when setting is changed in the Treatments section of the Settings screen
- small changes to improve carb marker readability
- chart y-axis will automatically adjust if the carb markers are shifted upwards
- initial translations added EN, ES
2023-12-18 14:57:18 +01:00
Paul Plant 231b3ae96d reduce bolus marker sizes slightly 2023-12-18 12:18:48 +01:00
Paul Plant af42ec78e9 implement "Time in Tight Range" option
Removed old TIR option based on user-set values in favor of the newer "Time in Tight Range" method.

Two options are now:
- standardized TIR (70-180mg/dL)
- newer TITR (70-140mg/dL)

- https://diatribe.org/time-tight-range-new-diabetes-goal

- added double tap gesture to the statistics view to quickly change between both types.

-
- added transition so that the user is visually shown which limits are changed when changing types

- added localization. Initial translations for EN, ES.

- changed many of the settings menu row descriptions to remove the "?" from them to clean up the look of them.
2023-12-18 12:12:50 +01:00
Paul Plant 462a59efe7 data source + sensor progress views updated
- initial translations added (EN, ES)
- server connectivity indicator for follower modes to indicate when there is a working connection to the server
- data source URL for Nightscout follower can be hidden during 20 seconds by double-tapping it (for posting screenshots)
- ConstantsDexcomFollower.swift renamed to ConstantsFollower.swift (as it was never related to Dexcom Follower anyway :) )
2023-12-17 15:57:46 +01:00
Paul Plant 3fe3259467 update default Nightscout URL
Previously we had an example Heroku URL but this service is now no longer the default option for most users, so let's just leave it blank.

Change from "https://yoursitename.herokuapp.com" to "https://"
2023-12-14 18:05:34 +01:00
Paul Plant 9bf0d45007 screen lock dimming overlay 2023-11-29 20:05:33 +01:00
Paul Plant bfe6dd4695 add sensor expired to sensor view 2023-11-19 11:21:27 +01:00
Paul Plant b314001881 initial implementation background keep-alive modes 2023-11-13 13:15:09 +01:00
Paul Plant 60874af5fd initial implementation sensor info view
- replaces the old image-based sensor countdown (only for Libre)
- will now work for all CGM systems that report a sensor start date (or sensor age in the case of Libre)
- if no current/valid data is found, the view remains hidden
- currently showing for Libre 2 EU BLE (14.5 days), compatible Libre via external transmitter (14.5 days), Dexcom G5/G6/One (10.0 days) and LibreLinkUp follower (14.0 days)
- starts at 0% progress for 0d and finishes at 100% progress for maxAge as per above line
- To simply UI, sensor countdown options are removed completely
- All maxAge values are in Constants file for easy updating if ever needed
2023-11-06 19:03:29 +01:00
Paul Plant 133853a6a7 update comments and remove debug code 2023-10-28 10:48:36 +02:00
Paul Plant e1e32598ff LibreLinkUp Follower - initial implementation 2023-10-24 18:21:29 +01:00
Liroy van Hoewijk 4091be7bd4
Fix AVAudioPlayer decoding issues (#458)
Reencode all sound files as .caf files with PCM mono LIE16 to prevent AVAudioPlayer() from crashing on locally installed instances via Xcode. This stops AVAudioPlayer from crashing in iOS17.
2023-09-15 21:29:17 +02:00
Paul Plant 1aba8029f9 initial commit - bg readings swiftui view 2023-07-30 20:53:15 +02:00
Paul Plant a830714ce6 add "warming up until xx:xx" to Dexcom bluetoothPeripheral screen
- set to display "warming up until xx:xx" until 120 minutes after the sensor session was started in the transmitter)
- most Dexcom users know this but it looks useful in the Libre 2 BLE UI, so we can just implement it here too
2023-02-07 19:39:16 +01:00
Paul Plant 96146daaec Calendar event visual indicator option
- calendar event visual indicator (#411)
- will change colour depending on BG value as per main chart objective values for (urgent high, high, low and urgent low)
- option added to show/hide visual indicator in Calendar Event settings
- small changes made to interval label texts

Co-Authored-By: Gary Dalley <4158482+gonkowonko@users.noreply.github.com>
2023-01-10 20:08:17 +01:00
Paul Plant 21494c3e33 add GitHub repo link to info section in settings
- no translations are needed as the text only says "Github"
2023-01-08 11:13:27 +01:00
Paul Plant 390a7318f3 enforce a minimum sensor warm-up time before processing new glucose values
- implemented to ensure a minimum time has passed since sensor activation
- especially necessary for Libre sensors (either Libre 2 BLE or Libre through transmitters) that can transmit glucose values immediately after activation. The first 50 minutes can often produce very unreliable values so it's better to just not process anything during this time.
- note that there is no set time after which the sensor values are reliable. Sometimes after 10 minutes, values are good. Sometimes it needs 30 or even 40 minutes.
- warm-up time is therefore initially set to 45 minutes warm-up time but minimumSensorWarmUpRequiredInMinutes can be edited in ConstantsMaster.swift
2023-01-08 10:42:11 +01:00
Paul Plant 3109e01498 limit BG readings to absolute maximum of 600 before processing by RVC 2023-01-07 21:12:01 +01:00
Paul Plant 603db60ff5 Libre 2 NFC re-write
- rewrite of NFC scan workflow
- initial scan of NFC-enabled sensors will now *not* initial BLE scanning
- NFC scan logic redone to perform several loops until a successful NFC scan with valid data is hopefully performed
- UI updated to inform user of scan attempts and give much clearer alert messages.
- haptic feedback (vibrations/noise) added to guide user during scan cycles
- a failed NFC scan will now inform the user and offer to immediately scan again. If the user declines the transmitter will be disconnected (if existing) or removed (if adding new)
- BLE Peripheral view should show correct status in connection row if pending NFC scan to continue
- once a valid NFC scan has been performed, the user will be informed and the superclass will be told to start BLE scanning to find the sensor/transmitter. This will avoid trying to connect before a valid NFC is performed
- the scanned sensor serial number is passed back through the delegate to update the expected device name at the same time as BLE scanning is started. This prevents the app from connecting to a different transmitter (i.e. Libre 2).
- when a Libre 2 sensor is disconnected, the active sensor is set to nil. This prevents the countdown from staying on screen with no valid sensor connected.
- as above but the libre1DerivedParameters are also set to nil to prevent an issue that can show very high readings when initially connecting to a new sensor
- related alert messages changed to improve clarity
- translations added for EN/NL/ES/FR/DE/PT/SV
2023-01-04 13:24:06 +01:00
Johan Degraeve 3f2a021a51 Option to define loopDelay dependent on the time of day
loopDelay means that readings shared with Loop will be shifted forward with a predefined amount of minutes. Example : a reading that is for instance created at 15:00, to which a delay is applied of 5 minutes, then Loop will receive that reading at 15:05, while at 15:00, Loop will receive the reading that was created at 14:55.
This is only useful when used in combination with smoothing. Advantage is that readings that Loop will receive are more efficiently smoothed

- new setting is available in the Developer settings
- used SwiftUI to define a new View that allows to create loopDelays
- colors used in SwiftUI code are defined in Constants/ConstantsUI.swift

- deployment target increased from 12.0 to 13.0
- String extension getSchedule renamed to splitToInt
2022-07-11 18:15:28 +02:00
Paul Plant 7cd23589e4 extra ranges for mini-chart
- added extra ranges to allow 24hr/48hr/3d and 7d options
- time period selected is now always shown but faded out
- when double tapped, the range changes to the next one and the label is turned white and then faded back out
2022-06-18 14:17:16 +02:00
Paul Plant 34bae76168 mini-chart initial implementation
This uses a new glucoseMiniGlucoseChart object to display a static 24hr or 48hr mini-chart beneath the main chart.
- simplified to display only glucose chart points with all axiis, guidelines and labels hidden.
- it will update every time new glucose readings are processed
- a double tap will toggle between 24hr and 48hr modes (default 24hrs)
- by default the mini-chart will be hidden (upon first ever launch) for users with "Zoomed Display" enabled. Otherwise, the mini-chart will be shown by default.
- as above but same logic also applied to the statistics view for first launch
- home screen settings menu edited to add option
- observer added to hide/show the chart after settings change and also to redraw the chart after hours are toggled by double tap
2022-06-17 17:48:06 +02:00
Paul Plant a4b8e67ff1 user locale implemented for all UI date and time displays
- chart hour axis label and scroll back timestamp will be shown in user locale
- treatment list time will be shown in user locale
- snooze screen times and dates will be shown in user locale
- BLE peripherals dates and times will be shown in user locale
- alarm dates and times will be shown in user locale
- landscape view date will be shown in user locale
- small improvements to layout of alarms screen
- schema updated to include location and allow region changes in simulator/debug
2022-06-05 20:54:24 +02:00
Johan Degraeve 45c189a87c
Merge pull request #353 from paulplant/additional_treatments
implement BG Check treatments + layout improvements
2022-05-30 22:22:36 +02:00
Paul Plant 87d2ae296f implement BG Check treatments
- BG Checks (finger prick) can be entered as a treatment
- will be converted and stored in coredata as mg/dl (to avoid having to add units to the treatment coredata model)
- will be converted and shown locally in the correct unit
- will be synced with Nightscout in the original unit
- Nightscout uploads will add the "GlucoseType"="Finger" and "units" attributes to align with BG checks entered via Care Portal.
- BG checks displayed on the main chart as a red circle with gray border as per Nightscout style
- observer added to refresh treatment table (values/units) if the bg unit is changed by the user
2022-05-20 13:22:33 +02:00
Johan Degraeve 5fdf6b5117 LoopManager : add 5 seconds to timestamp last reading + tracing
- add 5 seconds to last Readings timestamp, because due to the way timestamp for libre readings is calculated, it may happen that the same reading shifts 1 or 2 seconds in next reading cycle
- add tracing, can be deleted later on
2022-05-19 23:54:20 +02:00
eduardopietre 31c9d942ff Added traces to DataExporter. 2022-05-08 19:31:51 -03:00
eduardopietre 0defd2d6ce Housekeeping retention period can now be set in settings. 2022-05-07 20:20:39 -03:00