Compare commits
No commits in common. "f082eeadad814a4eda787436ca2c04ba8e518a77" and "a82a3697da26cbae86c0a565bf20d904c96fdaa1" have entirely different histories.
f082eeadad
...
a82a3697da
1 changed files with 2 additions and 12 deletions
|
|
@ -173,15 +173,6 @@ final class DXSmartProvisioner: NSObject, BeaconProvisioner {
|
|||
for (index, (name, packet)) in commands.enumerated() {
|
||||
await diagnosticLog?.log("write", "[\(index + 1)/\(commands.count)] \(name) (\(packet.count) bytes)")
|
||||
|
||||
// SaveConfig (last command) causes beacon MCU to reboot — it never sends an ACK.
|
||||
// Fire the BLE write and return immediately; the disconnect is expected.
|
||||
if name == "SaveConfig" {
|
||||
peripheral.writeValue(packet, for: writeChar, type: .withResponse)
|
||||
await diagnosticLog?.log("write", "✅ [\(index + 1)/\(commands.count)] SaveConfig sent — beacon will reboot")
|
||||
await diagnosticLog?.log("write", "✅ All commands written successfully")
|
||||
return
|
||||
}
|
||||
|
||||
// Retry each command up to 2 times — beacon BLE stack can be flaky
|
||||
var lastError: Error?
|
||||
for writeAttempt in 1...2 {
|
||||
|
|
@ -202,9 +193,8 @@ final class DXSmartProvisioner: NSObject, BeaconProvisioner {
|
|||
throw lastError
|
||||
}
|
||||
|
||||
// 300ms between commands — conservative speedup (was 500ms)
|
||||
// Beacon needs time to process each GATT write; 300ms tested safe
|
||||
try await Task.sleep(nanoseconds: 300_000_000)
|
||||
// 500ms between commands — beacon needs time to process
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue