removed the check on last shared reading or Loop, and sharing 12 readings now

This commit is contained in:
Johan Degraeve 2020-12-22 12:48:37 +01:00
parent e41d95bf2c
commit d04518ba85
3 changed files with 2 additions and 20 deletions

View File

@ -3,7 +3,7 @@ import Foundation
enum ConstantsShareWithLoop {
/// maximum number of readings to share with Loop
static let maxReadingsToShareWithLoop = 10
static let maxReadingsToShareWithLoop = 12
/// if the time between the last and last but one reading is less than minimiumTimeBetweenTwoReadingsInMinutes, then the reading will not be shared with loop - except if there's been a disconnect in between these two readings
static let minimiumTimeBetweenTwoReadingsInMinutes = 4.75

View File

@ -206,10 +206,6 @@ extension UserDefaults {
/// web oop parameters, only for Libre 1
case libre1DerivedAlgorithmParameters = "algorithmParameters"
// Loop share
/// timestamp lastest reading shared with Loop
case timeStampLatestLoopSharedBgReading = "timeStampLatestLoopSharedBgReading"
// development settings
/// G6 factor1 - for testing G6 scaling
@ -1013,16 +1009,6 @@ extension UserDefaults {
}
}
/// timestamp lastest reading uploaded to NightScout
var timeStampLatestLoopSharedBgReading:Date? {
get {
return object(forKey: Key.timeStampLatestLoopSharedBgReading.rawValue) as? Date
}
set {
set(newValue, forKey: Key.timeStampLatestLoopSharedBgReading.rawValue)
}
}
/// transmitterBatteryInfo, this should be the transmitter battery info of the latest active cgmTransmitter
var transmitterBatteryInfo:TransmitterBatteryInfo? {
get {

View File

@ -63,7 +63,7 @@ public class LoopManager:NSObject {
}
// applying minimumTimeBetweenTwoReadingsInMinutes filter, for loop
lastReadings = lastReadings.filter(minimumTimeBetweenTwoReadingsInMinutes: ConstantsShareWithLoop.minimiumTimeBetweenTwoReadingsInMinutes, lastConnectionStatusChangeTimeStamp: lastConnectionStatusChangeTimeStamp, timeStampLastProcessedBgReading: UserDefaults.standard.timeStampLatestLoopSharedBgReading)
lastReadings = lastReadings.filter(minimumTimeBetweenTwoReadingsInMinutes: ConstantsShareWithLoop.minimiumTimeBetweenTwoReadingsInMinutes, lastConnectionStatusChangeTimeStamp: lastConnectionStatusChangeTimeStamp, timeStampLastProcessedBgReading: nil)
// if there's no readings, then no further processing
if lastReadings.count == 0 {
@ -76,10 +76,6 @@ public class LoopManager:NSObject {
sharedUserDefaults.set(data, forKey: "latestReadings")
if let last = lastReadings.last {
UserDefaults.standard.timeStampLatestLoopSharedBgReading = last.timeStamp
}
}
}