Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Target Slot Information in Logs #141

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Source/Managers/DFU/FirmwareUpgradeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ public class FirmwareUpgradeManager : FirmwareUpgradeController, ConnectionObser
for i in self.images.indices where self.images[i].image == image.image && self.images[i].slot == activeSlot {
// Mark as Uploaded so we skip over it and don't send it.
markAsUploaded(self.images[i])
self.log(msg: "Two possible slots available for Image \(image.image). Image \(image.image) Slot \(activeSlot) is marked as currently Active, so we're uploading to the alternative Slot instead.", atLevel: .application)
}
} else {
validateSecondarySlotUpload(of: image, with: responseImages)
Expand Down Expand Up @@ -477,8 +478,8 @@ public class FirmwareUpgradeManager : FirmwareUpgradeController, ConnectionObser
guard let primary = responseImages.first(where: {
$0.image == image.image && $0.slot == image.slot
}) else { return }
log(msg: "Secondary slot of image \(image.image) is already confirmed", atLevel: .warning)
log(msg: "Confirming the primary slot of image \(image.image)...", atLevel: .verbose)
log(msg: "Secondary slot of Image \(image.image) is already confirmed", atLevel: .warning)
log(msg: "Confirming Image \(image.image) Slot \(image.slot)...", atLevel: .verbose)
listConfirm(image: primary)
return
}
Expand All @@ -496,7 +497,7 @@ public class FirmwareUpgradeManager : FirmwareUpgradeController, ConnectionObser
return
}
// Otherwise, do nothing, as the old firmware will be overwritten by the new one.
log(msg: "Secondary slot of image \(image.image) will be overwritten", atLevel: .warning)
log(msg: "Secondary Slot of image \(image.image) will be overwritten", atLevel: .warning)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Managers/ImageManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public class ImageManager: McuManager {
bleTransport.chunkSendDataToMtuSize = configuration.reassemblyBufferSize != 0
}

log(msg: "Uploading image \(firstImage.image) (\(firstImage.data.count) bytes)...", atLevel: .verbose)
log(msg: "Uploading Image \(firstImage.image) with Target Slot \(firstImage.slot) (\(firstImage.data.count) bytes)...", atLevel: .verbose)
upload(data: firstImage.data, image: firstImage.image, offset: 0,
alignment: configuration.byteAlignment,
callback: uploadCallback)
Expand Down Expand Up @@ -469,7 +469,7 @@ public class ImageManager: McuManager {
self.uploadIndex += 1
self.uploadLastOffset = 0
self.imageData = images[self.uploadIndex].data
self.log(msg: "Uploading image \(images[self.uploadIndex].image) (\(self.imageData?.count) bytes)...", atLevel: .application)
self.log(msg: "Uploading image \(images[self.uploadIndex].image) with Target Slot \(images[self.uploadIndex].slot) (\(self.imageData?.count) bytes)...", atLevel: .application)
self.uploadDelegate?.uploadProgressDidChange(bytesSent: 0, imageSize: images[self.uploadIndex].data.count, timestamp: Date())
self.sendNext(from: UInt64(0))
}
Expand Down