fix: trim auth and post-write delays from 600ms down to 100ms total
- Auth trigger settle: 100ms → 50ms - Auth password settle: 500ms → 50ms - Post-write reboot settle: 200ms → 50ms Beacon handles 50ms inter-command just fine, no reason for the beginning and end to be slower. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
38600193b7
commit
66cf65f803
2 changed files with 4 additions and 6 deletions
|
|
@ -384,15 +384,13 @@ final class DXSmartProvisioner: NSObject, BeaconProvisioner {
|
|||
// Step 1: Trigger — fire and forget (matches Android's WRITE_TYPE_NO_RESPONSE)
|
||||
if let triggerData = Self.triggerPassword.data(using: .utf8) {
|
||||
peripheral.writeValue(triggerData, for: ffe3, type: .withoutResponse)
|
||||
try await Task.sleep(nanoseconds: 100_000_000) // 100ms (matches Android SDK timer)
|
||||
try await Task.sleep(nanoseconds: 50_000_000) // 50ms settle
|
||||
}
|
||||
|
||||
// Step 2: Auth password — fire and forget
|
||||
if let authData = Self.defaultPassword.data(using: .utf8) {
|
||||
peripheral.writeValue(authData, for: ffe3, type: .withoutResponse)
|
||||
// 500ms settle after auth — beacon needs time to enter config mode,
|
||||
// especially if BLE stack was stressed by prior provisioner attempts
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
try await Task.sleep(nanoseconds: 50_000_000) // 50ms settle
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -620,8 +620,8 @@ struct ScanView: View {
|
|||
try await provisioner.writeConfig(config)
|
||||
writesCompleted = true
|
||||
|
||||
// Give the beacon 200ms to process SaveConfig before dropping the BLE link.
|
||||
try? await Task.sleep(nanoseconds: 200_000_000)
|
||||
// Brief settle after SaveConfig before dropping the BLE link.
|
||||
try? await Task.sleep(nanoseconds: 50_000_000)
|
||||
provisioner.disconnect()
|
||||
|
||||
try await APIClient.shared.registerBeaconHardware(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue