Преглед изворни кода

correction for dexcom G7 with initial tick timer method

avouspierre пре 3 година
родитељ
комит
f28eb38726
1 измењених фајлова са 8 додато и 2 уклоњено
  1. 8 2
      FreeAPS/Sources/APS/CGM/dexcomSourceG7.swift

+ 8 - 2
FreeAPS/Sources/APS/CGM/dexcomSourceG7.swift

@@ -25,7 +25,13 @@ final class DexcomSourceG7: GlucoseSource {
 
 
     func fetch(_: DispatchTimer?) -> AnyPublisher<[BloodGlucose], Never> {
     func fetch(_: DispatchTimer?) -> AnyPublisher<[BloodGlucose], Never> {
         // dexcomManager.transmitter.resumeScanning()
         // dexcomManager.transmitter.resumeScanning()
-        Just([]).eraseToAnyPublisher()
+        return Future<[BloodGlucose], Error> { [weak self] promise in
+            self?.promise = promise
+        }
+        .timeout(60, scheduler: processQueue, options: nil, customError: nil)
+        .replaceError(with: [])
+        .replaceEmpty(with: [])
+        .eraseToAnyPublisher()
     }
     }
 
 
     func fetchIfNeeded() -> AnyPublisher<[BloodGlucose], Never> {
     func fetchIfNeeded() -> AnyPublisher<[BloodGlucose], Never> {
@@ -112,7 +118,7 @@ extension DexcomSourceG7: CGMManagerDelegate {
         tickBLE: Bool,
         tickBLE: Bool,
         completion: @escaping () -> Void
         completion: @escaping () -> Void
     ) {
     ) {
-        warning(.deviceManager, "DEXCOMG7 - Process CGM Reading Result launched")
+        debug(.deviceManager, "DEXCOMG7 - Process CGM Reading Result launched")
         switch readingResult {
         switch readingResult {
         case let .newData(values):
         case let .newData(values):
             let bloodGlucose = values.compactMap { newGlucoseSample -> BloodGlucose? in
             let bloodGlucose = values.compactMap { newGlucoseSample -> BloodGlucose? in