|
@@ -447,7 +447,7 @@ extension LibreTransmitterManager {
|
|
|
glucose += LibreGlucose.fromHistoryMeasurements(sortedHistory, nativeCalibrationData: calibrationData)
|
|
glucose += LibreGlucose.fromHistoryMeasurements(sortedHistory, nativeCalibrationData: calibrationData)
|
|
|
}*/
|
|
}*/
|
|
|
|
|
|
|
|
- let newGlucose = glucosesToSamplesFilter(glucose, startDate: getStartDateForFilter())
|
|
|
|
|
|
|
+ var newGlucose = glucosesToSamplesFilter(glucose, startDate: getStartDateForFilter())
|
|
|
|
|
|
|
|
if newGlucose.isEmpty {
|
|
if newGlucose.isEmpty {
|
|
|
self.countTimesWithoutData &+= 1
|
|
self.countTimesWithoutData &+= 1
|
|
@@ -459,6 +459,10 @@ extension LibreTransmitterManager {
|
|
|
|
|
|
|
|
//todo: predictions also for libre2 bluetooth data
|
|
//todo: predictions also for libre2 bluetooth data
|
|
|
//self.latestPrediction = prediction?.first
|
|
//self.latestPrediction = prediction?.first
|
|
|
|
|
+ var predictions: [LibreGlucose] = []
|
|
|
|
|
+
|
|
|
|
|
+ overcalibrate(entries: &newGlucose, prediction: &predictions)
|
|
|
|
|
+
|
|
|
self.setObservables(sensorData: nil, bleData: bleData, metaData: device)
|
|
self.setObservables(sensorData: nil, bleData: bleData, metaData: device)
|
|
|
|
|
|
|
|
self.logger.debug("dabear:: handleGoodReading returned with \(newGlucose.count) entries")
|
|
self.logger.debug("dabear:: handleGoodReading returned with \(newGlucose.count) entries")
|
|
@@ -638,6 +642,12 @@ extension LibreTransmitterManager {
|
|
|
entries += LibreGlucose.fromHistoryMeasurements(history, nativeCalibrationData: calibration)
|
|
entries += LibreGlucose.fromHistoryMeasurements(history, nativeCalibrationData: calibration)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ overcalibrate(entries: &entries, prediction: &prediction)
|
|
|
|
|
+
|
|
|
|
|
+ return (glucose: entries, prediction: prediction)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private func overcalibrate(entries: inout [LibreGlucose], prediction: inout [LibreGlucose]) {
|
|
|
// overcalibrate
|
|
// overcalibrate
|
|
|
var overcalibration: ((Double) -> (Double))? = nil
|
|
var overcalibration: ((Double) -> (Double))? = nil
|
|
|
delegateQueue.sync { overcalibration = cgmManagerDelegate?.overcalibration(for: self) }
|
|
delegateQueue.sync { overcalibration = cgmManagerDelegate?.overcalibration(for: self) }
|
|
@@ -654,8 +664,6 @@ extension LibreTransmitterManager {
|
|
|
entries = overcalibrate(entries: entries)
|
|
entries = overcalibrate(entries: entries)
|
|
|
prediction = overcalibrate(entries: prediction)
|
|
prediction = overcalibrate(entries: prediction)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return (glucose: entries, prediction: prediction)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public func handleGoodReading(data: SensorData?, _ callback: @escaping (LibreError?, GlucoseArrayWithPrediction?) -> Void) {
|
|
public func handleGoodReading(data: SensorData?, _ callback: @escaping (LibreError?, GlucoseArrayWithPrediction?) -> Void) {
|