Skip to content

Commit

Permalink
5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-b-m authored Nov 22, 2024
1 parent 574a281 commit 859ec42
Show file tree
Hide file tree
Showing 65 changed files with 2,626 additions and 239 deletions.
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_DISPLAY_NAME = iAPS
APP_VERSION = 5.4.0
APP_VERSION = 5.6.0
APP_BUILD_NUMBER = 1
COPYRIGHT_NOTICE =
DEVELOPER_TEAM = ##TEAM_ID##
Expand Down
7 changes: 6 additions & 1 deletion Core_Data.xcdatamodeld/Core_Data.xcdatamodel/contents
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23231" systemVersion="23G93" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="23507" systemVersion="23G93" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
<entity name="ActiveProfile" representedClassName="ActiveProfile" syncable="YES" codeGenerationType="class">
<attribute name="active" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
Expand All @@ -22,6 +22,11 @@
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="error" optional="YES" attributeType="String"/>
</entity>
<entity name="InsulinConcentration" representedClassName="InsulinConcentration" syncable="YES" codeGenerationType="class">
<attribute name="concentration" optional="YES" attributeType="Double" defaultValueString="1" usesScalarValueType="YES"/>
<attribute name="date" optional="YES" attributeType="Date" defaultDateTimeInterval="752259840" usesScalarValueType="NO"/>
<attribute name="incrementSetting" optional="YES" attributeType="Double" defaultValueString="0.0" usesScalarValueType="YES"/>
</entity>
<entity name="InsulinDistribution" representedClassName="InsulinDistribution" syncable="YES" codeGenerationType="class">
<attribute name="bolus" optional="YES" attributeType="Decimal" defaultValueString="0.0"/>
<attribute name="date" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,22 @@ extension String {
}

public enum SensorType: String, CustomStringConvertible {
case libre1 = "DF"
case libre1A2 = "A2"
case libre2 = "9D"
case libre1 = "DF"
case libre1A2 = "A2"
case libre2 = "9D"
case libre2C5 = "C5"
case libreUS14day = "E5"
case libreUS14day = "E5"
case libreUS14dayE6 = "E6"
case libreProH = "70"
case libre2Plus = "C6"

public var description: String {
switch self {
case .libre1:
return "Libre 1"
case .libre1A2:
return "Libre 1 A2"
case .libre2, .libre2C5:
case .libre2, .libre2C5, .libre2Plus:
return "Libre 2"
case .libreUS14day, .libreUS14dayE6:
return "Libre US"
Expand All @@ -107,7 +108,7 @@ public extension SensorType {

let start = patchInfo[0..<2].uppercased()

let choices: [String: SensorType] = ["DF": .libre1, "A2": .libre1A2, "9D": .libre2, "C5": .libre2, "E5": .libreUS14day, "E6": .libreUS14dayE6, "70": .libreProH]
let choices: [String: SensorType] = ["DF": .libre1, "A2": .libre1A2, "9D": .libre2, "C5": .libre2C5, "C6": .libre2Plus, "E5": .libreUS14day, "E6": .libreUS14dayE6, "70": .libreProH]

if let res = choices[start] {
self = res
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public enum Libre2 {
/// - data: Encrypted FRAM data
/// - Returns: Decrypted FRAM data
static public func decryptFRAM(type: SensorType, id: [UInt8], info: [UInt8], data: [UInt8]) throws -> [UInt8] {
guard type == .libre2 || type == .libre2C5 || type == .libreUS14day || type == .libreUS14dayE6 else {
guard type == .libre2 || type == .libre2C5 || type == .libreUS14day || type == .libreUS14dayE6 || type == .libre2Plus else {
struct DecryptFRAMError: Error {
let errorDescription = "Unsupported sensor type"
}
Expand All @@ -24,8 +24,9 @@ public enum Libre2 {
return 0xcadc
}
return UInt16(info[5], info[4])
case .libre2, .libre2C5:
case .libre2, .libre2C5, .libre2Plus:
return UInt16(info[5], info[4]) ^ 0x44

default: fatalError("Unsupported sensor type")
}
}
Expand Down
56 changes: 46 additions & 10 deletions FreeAPS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
0F7A65FBD2CD8D6477ED4539 /* NotificationsConfigProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = E625985B47742D498CB1681A /* NotificationsConfigProvider.swift */; };
17A9D0899046B45E87834820 /* CREditorProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C8D5F457B5AFF763F8CF3DF /* CREditorProvider.swift */; };
19012CDC291D2CB900FB8210 /* LoopStats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19012CDB291D2CB900FB8210 /* LoopStats.swift */; };
1901412D2CDB92D600ABD925 /* RestoreDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1901412C2CDB92CB00ABD925 /* RestoreDataFlow.swift */; };
1901412F2CDB92F200ABD925 /* RestoreProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1901412E2CDB92E600ABD925 /* RestoreProvider.swift */; };
190141312CDB930400ABD925 /* RestoreStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190141302CDB92FB00ABD925 /* RestoreStateModel.swift */; };
190141342CDB931A00ABD925 /* RestoreRootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190141332CDB931000ABD925 /* RestoreRootView.swift */; };
190141362CDB9D4B00ABD925 /* Token.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190141352CDB9D4600ABD925 /* Token.swift */; };
190EBCC429FF136900BA767D /* StatConfigDataFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190EBCC329FF136900BA767D /* StatConfigDataFlow.swift */; };
190EBCC629FF138000BA767D /* StatConfigProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190EBCC529FF138000BA767D /* StatConfigProvider.swift */; };
190EBCC829FF13AA00BA767D /* StatConfigStateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 190EBCC729FF13AA00BA767D /* StatConfigStateModel.swift */; };
Expand Down Expand Up @@ -564,6 +569,11 @@
10A0C32B0DAB52726EF9B6D9 /* BolusRootView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BolusRootView.swift; sourceTree = "<group>"; };
12204445D7632AF09264A979 /* PreferencesEditorDataFlow.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PreferencesEditorDataFlow.swift; sourceTree = "<group>"; };
19012CDB291D2CB900FB8210 /* LoopStats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoopStats.swift; sourceTree = "<group>"; };
1901412C2CDB92CB00ABD925 /* RestoreDataFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestoreDataFlow.swift; sourceTree = "<group>"; };
1901412E2CDB92E600ABD925 /* RestoreProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestoreProvider.swift; sourceTree = "<group>"; };
190141302CDB92FB00ABD925 /* RestoreStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestoreStateModel.swift; sourceTree = "<group>"; };
190141332CDB931000ABD925 /* RestoreRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestoreRootView.swift; sourceTree = "<group>"; };
190141352CDB9D4600ABD925 /* Token.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Token.swift; sourceTree = "<group>"; };
190EBCC329FF136900BA767D /* StatConfigDataFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatConfigDataFlow.swift; sourceTree = "<group>"; };
190EBCC529FF138000BA767D /* StatConfigProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatConfigProvider.swift; sourceTree = "<group>"; };
190EBCC729FF13AA00BA767D /* StatConfigStateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatConfigStateModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1196,6 +1206,25 @@
path = View;
sourceTree = "<group>";
};
1901412B2CDB92B500ABD925 /* Restore */ = {
isa = PBXGroup;
children = (
1901412C2CDB92CB00ABD925 /* RestoreDataFlow.swift */,
1901412E2CDB92E600ABD925 /* RestoreProvider.swift */,
190141302CDB92FB00ABD925 /* RestoreStateModel.swift */,
190141322CDB930800ABD925 /* View */,
);
path = Restore;
sourceTree = "<group>";
};
190141322CDB930800ABD925 /* View */ = {
isa = PBXGroup;
children = (
190141332CDB931000ABD925 /* RestoreRootView.swift */,
);
path = View;
sourceTree = "<group>";
};
190EBCC229FF134900BA767D /* StatConfig */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1440,28 +1469,24 @@
3811DE0325C9D31700A708ED /* Modules */ = {
isa = PBXGroup;
children = (
F2159A472BA60A0300A0B716 /* ContactTrick */,
19F191D92BE4F93400F6297E /* Sharing */,
195D80B22AF696EE00D25097 /* Dynamic */,
190EBCC229FF134900BA767D /* StatConfig */,
BD7DA9A32AE06DBA00601B20 /* BolusCalculatorConfig */,
19F95FF129F10F9C00314DDC /* Stat */,
CE94597C29E9E1CD0047C9C6 /* WatchConfig */,
19E1F7E629D0828B005C8D20 /* IconConfig */,
19D466A129AA2B0A004D5F33 /* FPUConfig */,
F90692CD274B99850037068D /* HealthKit */,
6DC5D590658EF8B8DF94F9F5 /* AddCarbs */,
A9A4C88374496B3C89058A89 /* AddTempTarget */,
672F63EEAE27400625E14BAD /* AutotuneConfig */,
A42F1FEDFFD0DDE00AAD54D3 /* BasalProfileEditor */,
3811DE0425C9D32E00A708ED /* Base */,
C2C98283C436DB934D7E7994 /* Bolus */,
BD7DA9A32AE06DBA00601B20 /* BolusCalculatorConfig */,
E8176B120B55CE89F1591542 /* Calibrations */,
F75CB57ED6971B46F8756083 /* CGM */,
0610F7D6D2EC00E3BA1569F0 /* ConfigEditor */,
F2159A472BA60A0300A0B716 /* ContactTrick */,
E42231DBF0DBE2B4B92D1B15 /* CREditor */,
9E56E3626FAD933385101B76 /* DataTable */,
195D80B22AF696EE00D25097 /* Dynamic */,
19D466A129AA2B0A004D5F33 /* FPUConfig */,
F90692CD274B99850037068D /* HealthKit */,
3811DE2725C9D49500A708ED /* Home */,
19E1F7E629D0828B005C8D20 /* IconConfig */,
D8F047E14D567F2B5DBEFD96 /* ISFEditor */,
C11D545CED3ECEB525EDEE23 /* LibreConfig */,
3811DE1A25C9D48300A708ED /* Main */,
Expand All @@ -1472,9 +1497,14 @@
3E1C41D9301B7058AA7BF5EA /* PreferencesEditor */,
99C01B871ACAB3F32CE755C7 /* PumpConfig */,
E493126EA71765130F64CCE5 /* PumpSettingsEditor */,
1901412B2CDB92B500ABD925 /* Restore */,
3811DE3825C9D4A100A708ED /* Settings */,
19F191D92BE4F93400F6297E /* Sharing */,
29B478DF61BF8D270F7D8954 /* Snooze */,
19F95FF129F10F9C00314DDC /* Stat */,
190EBCC229FF134900BA767D /* StatConfig */,
6517011F19F244F64E1FF14B /* TargetsEditor */,
CE94597C29E9E1CD0047C9C6 /* WatchConfig */,
);
path = Modules;
sourceTree = "<group>";
Expand Down Expand Up @@ -1927,6 +1957,7 @@
388E5A5A25B6F05F0019842D /* Helpers */ = {
isa = PBXGroup;
children = (
190141352CDB9D4600ABD925 /* Token.swift */,
FEFA5C10299F814A00765C17 /* CoreDataStack.swift */,
38F37827261260DC009DB701 /* Color+Extensions.swift */,
389ECE042601144100D86C4F /* ConcurrentMap.swift */,
Expand Down Expand Up @@ -2959,6 +2990,7 @@
38C4D33725E9A1A300D30B77 /* DispatchQueue+Extensions.swift in Sources */,
F90692CF274B999A0037068D /* HealthKitDataFlow.swift in Sources */,
CE7CA3552A064973004BE681 /* ListStateIntent.swift in Sources */,
190141362CDB9D4B00ABD925 /* Token.swift in Sources */,
19F191DE2BE4F97F00F6297E /* SharingProvider.swift in Sources */,
195D80B72AF697B800D25097 /* DynamicDataFlow.swift in Sources */,
3862CC2E2743F9F700BF832C /* CalendarManager.swift in Sources */,
Expand Down Expand Up @@ -3014,6 +3046,7 @@
38569348270B5DFB0002C50D /* GlucoseSource.swift in Sources */,
CEB434E328B8F9DB00B70274 /* BluetoothStateManager.swift in Sources */,
3811DE4225C9D4A100A708ED /* SettingsDataFlow.swift in Sources */,
1901412D2CDB92D600ABD925 /* RestoreDataFlow.swift in Sources */,
3811DE2525C9D48300A708ED /* MainRootView.swift in Sources */,
CE94598229E9E3D30047C9C6 /* WatchConfigProvider.swift in Sources */,
191A9D162BED00A500028D48 /* Version.swift in Sources */,
Expand All @@ -3033,6 +3066,7 @@
1920BF5D2B9DF53200E861FE /* BolusShortcut.swift in Sources */,
38A13D3225E28B4B00EAA382 /* PumpHistoryEvent.swift in Sources */,
E00EEC0627368630002FF094 /* UIAssembly.swift in Sources */,
1901412F2CDB92F200ABD925 /* RestoreProvider.swift in Sources */,
3811DE1825C9D40400A708ED /* Router.swift in Sources */,
CE7950262998056D00FA576E /* CGMSetupView.swift in Sources */,
38A0363B25ECF07E00FCBB52 /* GlucoseStorage.swift in Sources */,
Expand Down Expand Up @@ -3102,6 +3136,7 @@
3811DE3F25C9D4A100A708ED /* SettingsStateModel.swift in Sources */,
CE7CA3582A064E2F004BE681 /* ListStateView.swift in Sources */,
193F6CDD2A512C8F001240FD /* Loops.swift in Sources */,
190141342CDB931A00ABD925 /* RestoreRootView.swift in Sources */,
38B4F3CB25E502E200E76A18 /* WeakObjectSet.swift in Sources */,
38E989DD25F5021400C0CED0 /* PumpStatus.swift in Sources */,
BDFD165A2AE40438007F0DDA /* AlternativeBolusCalcRootView.swift in Sources */,
Expand Down Expand Up @@ -3135,6 +3170,7 @@
19AEF4322B1F5A98006FFE8B /* TIRView.swift in Sources */,
38A43598262E0E4900E80935 /* FetchAnnouncementsManager.swift in Sources */,
642F76A05A4FF530463A9FD0 /* NightscoutConfigRootView.swift in Sources */,
190141312CDB930400ABD925 /* RestoreStateModel.swift in Sources */,
190F8CF72BC6F70800EDB473 /* IllustrationView.swift in Sources */,
19DB70A72BF8F01E00C05381 /* ActiveCOBView.swift in Sources */,
BD7DA9AC2AE06EB900601B20 /* BolusCalculatorConfigRootView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
"template-rendering-intent" : "original"
}
}
10 changes: 2 additions & 8 deletions FreeAPS/Resources/javascript/prepare/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function generate(iob, currenttemp, glucose, profile, autosens = null, meal = nu
if (dynamicVariables && dynamicVariables.useOverride) {
const factor = dynamicVariables.overridePercentage / 100;
if (factor != 1) {
// Basal
profile.current_basal *= factor;
// Basal has already been adjusted in prepare/profile.js
console.log("Override active (" + factor + "), new basal: (" + profile.current_basal + ")")
// ISF and CR
if (dynamicVariables.isfAndCr) {
profile.sens /= factor;
Expand Down Expand Up @@ -236,12 +236,6 @@ function dynisf(profile, autosens_data, dynamicVariables, glucose) {
if (enable_sigmoid) {
console.log("Dynamic ISF enabled. Dynamic Ratio (Sigmoid function): " + newRatio + ". New ISF = " + isf + " mg/dl / " + round(0.0555 * isf, 1) + " mmol/l.");
}

// Basal Adjustment
if (profile.tddAdjBasal && dynISFenabled) {
profile.current_basal *= tdd_factor;
console.log("Dynamic ISF. Basal adjusted with TDD factor: " + round(tdd_factor, 2));
}
}

function round(value, digits) {
Expand Down
9 changes: 0 additions & 9 deletions FreeAPS/Resources/javascript/prepare/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ function generate(iob, currenttemp, glucose, profile, autosens = null, meal = nu
console.log("Invalid middleware: " + error);
string = String(error);
};

if (profile.tddAdjBasal && dynamicVariables.average_total_data != 0) {
profile.tdd_factor = Math.round( (dynamicVariables.weightedAverage / dynamicVariables.average_total_data) * 100) / 100;
const adjusted = Math.min(Math.max(profile.autosens_min, profile.tdd_factor), profile.autosens_max);
if (profile.tdd_factor != adjusted) {
console.log("Dynamic basal adjustment limited by your autosens_min/max settings to: " + adjusted);
profile.tdd_factor = adjusted;
}
}

profile.old_cr = profile.carb_ratio;
profile.old_isf = profile.sens;
Expand Down
5 changes: 0 additions & 5 deletions FreeAPS/Resources/javascript/prepare/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ function generate(pumpsettings_data, bgtargets_data, isf_data, basalprofile_data
Math.max(35, Math.min(preferences.insulinPeakTime, 100));
} else { preferences.insulinPeakTime = 55; }
}
// Migrate missing conversion from original freeaps
if (preferences.resistanceLowersTarget) {
preferences.resistance_lowers_target = true;
}
}

var tdd_factor = { };
Expand Down Expand Up @@ -140,7 +136,6 @@ function generate(pumpsettings_data, bgtargets_data, isf_data, basalprofile_data
enableDynamicCR: false,
sigmoid: false,
weightPercentage: 0.65,
tddAdjBasal: false,
// threshold_setting: temporary fix to test thomasvargiu/iAPS#original-oref0 branch before build.
// We can remove it after merged and after build the new original bundles
// because it's included in the current oref0 PR (https://github.com/openaps/oref0/pull/1465/files)
Expand Down
1 change: 0 additions & 1 deletion FreeAPS/Resources/json/defaults/preferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"useNewFormula" : false,
"useWeightedAverage" : true,
"weightPercentage" : 0.65,
"tddAdjBasal" : false,
"enableSMB_high_bg" : false,
"enableSMB_high_bg_target" : 110,
"threshold_setting" : 65,
Expand Down
Loading

0 comments on commit 859ec42

Please sign in to comment.