Просмотр исходного кода

nonce display & OmniBLE/OmniKit PodCommsSession.swift consistency updates (#456)

+ Have SetInsulinScheduleCommand debugDescription display hex nonce values
+ Update OmniBLE programInitialBasalSchedule() to add missing dose append
+ Update OmniBLE recoverUnacknowledgedCommand() to use log.default()
+ Update OmniKit resumeBasal() to omit useless completionBeep parameter
+ Update OmniKit send() beepBlock commenting to match OmniBLE
Joe Moran 2 лет назад
Родитель
Сommit
37903ae852

+ 1 - 1
Dependencies/OmniBLE/OmniBLE/OmnipodCommon/MessageBlocks/SetInsulinScheduleCommand.swift

@@ -209,6 +209,6 @@ public struct SetInsulinScheduleCommand : NonceResyncableMessageBlock {
 
 extension SetInsulinScheduleCommand: CustomDebugStringConvertible {
     public var debugDescription: String {
-        return "SetInsulinScheduleCommand(nonce:\(nonce), \(deliverySchedule))"
+        return "SetInsulinScheduleCommand(nonce:\(Data(bigEndian: nonce).hexadecimalString), \(deliverySchedule))"
     }
 }

+ 3 - 2
Dependencies/OmniBLE/OmniBLE/PumpManager/PodCommsSession.swift

@@ -369,6 +369,7 @@ public class PodCommsSession {
             podState.updateFromStatusResponse(status, at: currentDate)
             if status.podProgressStatus == .basalInitialized {
                 podState.setupProgress = .initialBasalScheduleSet
+                podState.finalizedDoses.append(UnfinalizedDose(resumeStartTime: currentDate, scheduledCertainty: .certain, insulinType: podState.insulinType))
                 return
             }
         }
@@ -880,10 +881,10 @@ public class PodCommsSession {
             self.log.default("Recovering from unacknowledged command %{public}@, status = %{public}@", String(describing: pendingCommand), String(describing: status))
 
             if status.lastProgrammingMessageSeqNum == pendingCommand.sequence {
-                self.log.debug("Unacknowledged command was received by pump")
+                self.log.default("Unacknowledged command was received by pump")
                 unacknowledgedCommandWasReceived(pendingCommand: pendingCommand, podStatus: status)
             } else {
-                self.log.debug("Unacknowledged command was not received by pump")
+                self.log.default("Unacknowledged command was not received by pump")
             }
             podState.unacknowledgedCommand = nil
         }

+ 1 - 1
Dependencies/OmniKit/OmniKit/OmnipodCommon/MessageBlocks/SetInsulinScheduleCommand.swift

@@ -208,6 +208,6 @@ public struct SetInsulinScheduleCommand : NonceResyncableMessageBlock {
 
 extension SetInsulinScheduleCommand: CustomDebugStringConvertible {
     public var debugDescription: String {
-        return "SetInsulinScheduleCommand(nonce:\(nonce), \(deliverySchedule))"
+        return "SetInsulinScheduleCommand(nonce:\(Data(bigEndian: nonce).hexadecimalString), \(deliverySchedule))"
     }
 }

+ 2 - 2
Dependencies/OmniKit/OmniKit/PumpManager/PodCommsSession.swift

@@ -238,7 +238,7 @@ public class PodCommsSession {
     ///
     /// - Parameters:
     ///   - messageBlocks: The message blocks to send
-    ///   - beepBlock: If specified, confirmation beep block message to append to the message blocks to send
+    ///   - beepBlock: Optional confirmation beep block message to append to the message blocks to send
     ///   - expectFollowOnMessage: If true, the pod will expect another message within 4 minutes, or will alarm with an 0x33 (51) fault.
     /// - Returns: The received message response
     /// - Throws:
@@ -778,7 +778,7 @@ public class PodCommsSession {
         }
     }
 
-    public func resumeBasal(schedule: BasalSchedule, scheduleOffset: TimeInterval, acknowledgementBeep: Bool = false, completionBeep: Bool = false, programReminderInterval: TimeInterval = 0) throws -> StatusResponse {
+    public func resumeBasal(schedule: BasalSchedule, scheduleOffset: TimeInterval, acknowledgementBeep: Bool = false, programReminderInterval: TimeInterval = 0) throws -> StatusResponse {
 
         guard podState.unacknowledgedCommand == nil else {
             throw PodCommsError.unacknowledgedCommandPending