Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Artificial-Pancreas/iAPS int…
Browse files Browse the repository at this point in the history
…o dev-bo
  • Loading branch information
actions-user committed Oct 20, 2023
2 parents 8a74c02 + 5f4e1a9 commit bf0ef62
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion FreeAPS/Resources/javascript/bundle/determine-basal.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions FreeAPS/Sources/APS/APSManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,13 @@ final class BaseAPSManager: APSManager, Injectable {
return Just(false).eraseToAnyPublisher()
}

guard glucoseStorage.isGlucoseNotFlat() else {
debug(.apsManager, "Glucose data is too flat")
processError(APSError.glucoseError(message: "Glucose data is too flat"))
return Just(false).eraseToAnyPublisher()
// Only let glucose be flat when 400 mg/dl
if (glucoseStorage.recent().last?.glucose ?? 100) != 400 {
guard glucoseStorage.isGlucoseNotFlat() else {
debug(.apsManager, "Glucose data is too flat")
processError(APSError.glucoseError(message: "Glucose data is too flat"))
return Just(false).eraseToAnyPublisher()
}
}

let now = Date()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ extension DataTable {
}
label: { Text("Save") }
.frame(maxWidth: .infinity, alignment: .trailing)
.disabled(state.manualGlcuose < limitLow || state.manualGlcuose > limitHigh)
// .disabled(state.manualGlcuose < limitLow || state.manualGlcuose > limitHigh)

}.padding(20)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct CurrentGlucoseView: View {
VStack(alignment: .center) {
HStack {
Text(
recentGlucose?.glucose
(recentGlucose?.glucose ?? 100) == 400 ? "HIGH" : recentGlucose?.glucose
.map {
glucoseFormatter
.string(from: Double(units == .mmolL ? $0.asMmolL : Decimal($0)) as NSNumber)! }
Expand Down
3 changes: 3 additions & 0 deletions FreeAPS/Sources/Modules/Home/View/HomeRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ extension Home {
.padding(.bottom, 4)
.padding(.top, 8)
Text(errorMessage).font(.caption).foregroundColor(.loopRed)
} else if let suggestion = state.suggestion, (suggestion.bg ?? 100) == 400 {
Text("Invalid CGM reading (HIGH).").font(.callout).bold().foregroundColor(.loopRed).padding(.top, 8)
Text("SMBs and High Temps Disabled.").font(.caption).foregroundColor(.white).padding(.bottom, 4)
}
}
}
Expand Down

0 comments on commit bf0ef62

Please sign in to comment.