mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Updated rawbg settings to use a single setting tri-state variable.
This commit is contained in:
@@ -319,8 +319,10 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm
|
||||
|
||||
##### `rawbg` (Raw BG)
|
||||
Calculates BG using sensor and calibration records from and displays an alternate BG values and noise levels. Defaults that can be adjusted with [extended setting](#extended-settings)
|
||||
* `SMOOTH` (`false`) - If `SMOOTH` is false, rawbg will be calculated such that it exagerates direction changes to provide early visible indication of glucose trend changes.
|
||||
* `UNFILTERED` (`false`) - If `UNFILTERED` is false, rawbg will be calculated using the raw filtered value. If `UNFILTERED` is true, rawbg will be calculated using the raw unfiltered value.
|
||||
* `DISPLAY` (`unsmoothed`) - Allows the user to control which algorithm is used to calculate the displayed raw BG values using the most recent calibration record.
|
||||
* `unfiltered` - Raw BG is calculated by applying the calibration to the glucose record's unfiltered value.
|
||||
* `filtered` - Raw BG is calculated by applying the calibration to the glucose record's filtered value. The glucose record's filtered values are generally produced by the CGM by a running average of the unfiltered values to produce a smoothed value when the sensor noise is high.
|
||||
* `unsmoothed` - Raw BG is calculated by first finding the ratio of the calculated filtered value (the same value calculated by the `filtered` setting) to the reported glucose value. The displayed raw BG value is calculated by dividing the calculated unfiltered value (the same value calculated by the `unfiltered` setting) by the ratio. The effect is to exagerate changes in trend direction so the trend changes are more noticeable to the user. This is the legacy raw BG calculation algorithm.
|
||||
|
||||
##### `iob` (Insulin-on-Board)
|
||||
Adds the IOB pill visualization in the client and calculates values that used by other plugins. Uses treatments with insulin doses and the `dia` and `sens` fields from the [treatment profile](#treatment-profile).
|
||||
|
||||
@@ -15,8 +15,7 @@ function init (ctx) {
|
||||
|
||||
rawbg.getPrefs = function getPrefs (sbx) {
|
||||
return {
|
||||
smooth: (sbx && sbx.extendedSettings.smooth) ? sbx.extendedSettings.smooth : false
|
||||
, unfiltered: (sbx && sbx.extendedSettings.unfiltered) ? sbx.extendedSettings.unfiltered : false
|
||||
display: (sbx && sbx.extendedSettings.display) ? sbx.extendedSettings.display : 'unsmoothed'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -64,9 +63,9 @@ function init (ctx) {
|
||||
|
||||
if (cleaned.slope === 0 || cleaned.unfiltered === 0 || cleaned.scale === 0) {
|
||||
raw = 0;
|
||||
} else if (cleaned.filtered === 0 || sgv.mgdl < 40 || prefs.unfiltered) {
|
||||
} else if (cleaned.filtered === 0 || sgv.mgdl < 40 || prefs.display === 'unfiltered') {
|
||||
raw = cleaned.scale * (cleaned.unfiltered - cleaned.intercept) / cleaned.slope;
|
||||
} else if (prefs.smooth) {
|
||||
} else if (prefs.display === 'filtered') {
|
||||
raw = cleaned.scale * (cleaned.filtered - cleaned.intercept) / cleaned.slope;
|
||||
} else {
|
||||
var ratio = cleaned.scale * (cleaned.filtered - cleaned.intercept) / cleaned.slope / sgv.mgdl;
|
||||
|
||||
Reference in New Issue
Block a user