Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
2 new bug fixes.
Lower carb ratio to a minimum of 0.1 g/U.
Add a freeaps_settings default json.
  • Loading branch information
Jon-b-m committed Aug 29, 2023
2 parents f43b712 + c9022c2 commit 4fecee2
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 52 deletions.
2 changes: 1 addition & 1 deletion FreeAPS/Resources/javascript/bundle/determine-basal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion FreeAPS/Resources/javascript/bundle/profile.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions FreeAPS/Resources/javascript/prepare/autotune-prep.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function generate(pumphistory_data, profile_data, glucose_data, pumpprofile_data, carb_data = {} , categorize_uam_as_basal = false, tune_insulin_curve = false) {
if (typeof(profile_data.carb_ratio) === 'undefined' || profile_data.carb_ratio < 1) {
if (typeof(pumpprofile_data.carb_ratio) === 'undefined' || pumpprofile_data.carb_ratio < 1) {
if (typeof(profile_data.carb_ratio) === 'undefined' || profile_data.carb_ratio < 0.1) {
if (typeof(pumpprofile_data.carb_ratio) === 'undefined' || pumpprofile_data.carb_ratio < 0.1) {
console.log('{ "carbs": 0, "mealCOB": 0, "reason": "carb_ratios ' + profile_data.carb_ratio + ' and ' + pumpprofile_data.carb_ratio + ' out of bounds" }');
return console.error("Error: carb_ratios " + profile_data.carb_ratio + ' and ' + pumpprofile_data.carb_ratio + " out of bounds");
} else {
Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Resources/javascript/prepare/meal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//для monitor/meal.json параметры: monitor/pumphistory-24h-zoned.json settings/profile.json monitor/clock-zoned.json monitor/glucose.json settings/basal_profile.json monitor/carbhistory.json

function generate(pumphistory_data, profile_data, clock_data, glucose_data, basalprofile_data, carbhistory = false) {
if (typeof(profile_data.carb_ratio) === 'undefined' || profile_data.carb_ratio < 1) {
if (typeof(profile_data.carb_ratio) === 'undefined' || profile_data.carb_ratio < 0.1) {
return {"error":"Error: carb_ratio " + profile_data.carb_ratio + " out of bounds"};
}

Expand Down
82 changes: 42 additions & 40 deletions FreeAPS/Resources/json/defaults/freeaps/freeaps_settings.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
{
"useAlarmSound" : false,
"uploadStats" : false,
"useCalendar" : false,
"rulerMarks" : false,
"individualAdjustmentFactor" : 0.5,
"low" : 70,
"displayHR" : true,
"localGlucosePort" : 8080,
"uploadGlucose" : true,
"allowAnnouncements" : false,
"debugOptions" : false,
"useAppleHealth" : false,
"high" : 170,
"yGridLines" : true,
"useLocalGlucoseSource" : false,
"closedLoop" : false,
"units" : "mmol/L",
"xGridLines" : true,
"lowGlucose" : 70,
"oneDimensionalGraph" : false,
"glucoseNotificationsAlways" : false,
"addSourceInfoToGlucoseNotifications" : false,
"cgm" : "nightscout",
"glucoseBadge" : true,
"overrideHbA1cUnit" : false,
"delay" : 80,
"smoothGlucose" : false,
"skipBolusScreenAfterCarbs" : false,
"highGlucose" : 220,
"timeCap" : 8,
"minuteInterval" : 20,
"isUploadEnabled" : true,
"useAutotune" : false,
"hours" : 6,
"carbsRequiredThreshold" : 50,
"insulinReqPercentage" : 80,
"useFPUconversion" : false,
"displayOnWatch" : "HR",
"animatedBackground" : false
"maxCarbs": 1000
"units" : "mmol/L",
"closedLoop" : false,
"allowAnnouncements" : false,
"useAutotune" : false,
"onlyAutotuneBasals" : false,
"isUploadEnabled" : false,
"useLocalGlucoseSource" : false,
"localGlucosePort" : 8080,
"debugOptions" : false,
"insulinReqPercentage" : 70,
"skipBolusScreenAfterCarbs" : false,
"displayHR" : false,
"cgm" : "nightscout",
"uploadGlucose" : true,
"useCalendar" : false,
"glucoseBadge" : false,
"glucoseNotificationsAlways" : false,
"useAlarmSound" : false,
"addSourceInfoToGlucoseNotifications" : false,
"lowGlucose" : 72,
"highGlucose" : 270,
"carbsRequiredThreshold" : 10,
"animatedBackground" : false,
"useFPUconversion" : true,
"individualAdjustmentFactor" : 0.5,
"timeCap" : 8,
"minuteInterval" : 30,
"delay" : 60,
"useAppleHealth" : false,
"smoothGlucose" : false,
"displayOnWatch" : "BGTarget",
"overrideHbA1cUnit" : false,
"high" : 145,
"low" : 70,
"uploadStats" : true,
"hours" : 6,
"xGridLines" : true,
"yGridLines" : true,
"oneDimensionalGraph" : false,
"rulerMarks" : false,
"maxCarbs": 1000,
"displayFatAndProteinOnWatch": false
}
53 changes: 53 additions & 0 deletions FreeAPS/Resources/json/defaults/preferences.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"max_iob" : 0,
"max_daily_safety_multiplier" : 3,
"current_basal_safety_multiplier" : 4,
"autosens_max" : 1.2,
"autosens_min" : 0.7,
"smb_delivery_ratio" : 0.5,
"rewind_resets_autosens" : true,
"high_temptarget_raises_sensitivity" : false,
"low_temptarget_lowers_sensitivity" : false,
"sensitivity_raises_target" : true,
"resistanceLowersTarget" : false,
"adv_target_adjustments" : false,
"exercise_mode" : false,
"half_basal_exercise_target" : 160,
"maxCOB" : 120,
"wide_bg_target_range" : false,
"skip_neutral_temps" : false,
"unsuspend_if_no_temp" : false,
"min_5m_carbimpact" : 8,
"autotune_isf_adjustmentFraction" : 1,
"remainingCarbsFraction" : 1,
"remainingCarbsCap" : 90,
"enableUAM" : false,
"A52_risk_enable" : false,
"enableSMB_with_COB" : false,
"enableSMB_with_temptarget" : false,
"enableSMB_always" : false,
"enableSMB_after_carbs" : false,
"allowSMB_with_high_temptarget" : false,
"maxSMBBasalMinutes" : 30,
"maxUAMSMBBasalMinutes" : 30,
"SMBInterval" : 3,
"bolus_increment" : 0.1,
"curve" : "rapid-acting",
"useCustomPeakTime" : false,
"insulinPeakTime" : 75,
"carbsReqThreshold" : 1,
"noisyCGMTargetMultiplier" : 1.3,
"suspend_zeros_iob" : false,
"maxDelta_bg_threshold" : 0.2,
"adjustmentFactor" : 0.5,
"sigmoid" : false,
"enableDynamicCR" : false,
"useNewFormula" : false,
"useWeightedAverage" : false,
"weightPercentage" : 0.65,
"tddAdjBasal" : false,
"enableSMB_high_bg" : false,
"enableSMB_high_bg_target" : 110,
"threshold_setting" : 65,
"updateInterval" : 20
}
2 changes: 1 addition & 1 deletion FreeAPS/Resources/json/defaults/settings/bg_targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"targets": [
{
"low": 5.5,
"high": 6.0,
"high": 5.5,
"start": "00:00:00",
"offset": 0
}
Expand Down
6 changes: 3 additions & 3 deletions FreeAPS/Sources/Models/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ struct Preferences: JSON {
var autosensMin: Decimal = 0.7
var smbDeliveryRatio: Decimal = 0.5
var rewindResetsAutosens: Bool = true
var highTemptargetRaisesSensitivity: Bool = true
var lowTemptargetLowersSensitivity: Bool = true
var highTemptargetRaisesSensitivity: Bool = false
var lowTemptargetLowersSensitivity: Bool = false
var sensitivityRaisesTarget: Bool = true
var resistanceLowersTarget: Bool = false
var advTargetAdjustments: Bool = false
Expand Down Expand Up @@ -39,7 +39,7 @@ struct Preferences: JSON {
var insulinPeakTime: Decimal = 75
var carbsReqThreshold: Decimal = 1.0
var noisyCGMTargetMultiplier: Decimal = 1.3
var suspendZerosIOB: Bool = true
var suspendZerosIOB: Bool = false
var timestamp: Date?
var maxDeltaBGthreshold: Decimal = 0.2
var adjustmentFactor: Decimal = 0.5
Expand Down
2 changes: 1 addition & 1 deletion FreeAPS/Sources/Modules/CREditor/CREditorStateModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ extension CREditor {

let timeValues = stride(from: 0.0, to: 1.days.timeInterval, by: 30.minutes.timeInterval).map { $0 }

let rateValues = stride(from: 15.0, to: 501.0, by: 1.0).map { ($0.decimal ?? .zero) / 10 }
let rateValues = stride(from: 1.0, to: 501.0, by: 1.0).map { ($0.decimal ?? .zero) / 10 }

var canAdd: Bool {
guard let lastItem = items.last else { return true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,9 @@ extension OverrideProfilesConfig {
let durationString = perpetual ? "" : "\(formatter.string(from: duration as NSNumber)!)"
let scheduledSMBstring = (preset.smbIsOff && preset.smbIsAlwaysOff) ? "Scheduled SMBs" : ""
let smbString = (preset.smbIsOff && scheduledSMBstring == "") ? "SMBs are off" : ""
let targetString = target != 0 ? "\(formatter.string(from: target as NSNumber)!)" : ""
let targetString = target != 0 ? "\(glucoseFormatter.string(from: target as NSNumber)!)" : ""
let maxMinutesSMB = (preset.smbMinutes as Decimal?) != nil ? (preset.smbMinutes ?? 0) as Decimal : 0
let maxMinutesUAM = (preset.uamMinutes as Decimal?) != nil ? (preset.uamMinutes ?? 0) as Decimal : 0

let isfString = preset.isf ? "ISF" : ""
let crString = preset.cr ? "CR" : ""
let dash = crString != "" ? "/" : ""
Expand Down

0 comments on commit 4fecee2

Please sign in to comment.