From a08d3db893a5f3fea0a9f9af7030e52aa36ec7be Mon Sep 17 00:00:00 2001 From: Schwifty Date: Mon, 23 Mar 2026 04:04:45 +0000 Subject: [PATCH] fix: explicitly disconnect after writeConfig so beacon can reboot After SaveConfig is sent, the DXSmartProvisioner.writeConfig() returns but never disconnects. The beacon MCU needs the BLE link dropped to finalize its save-and-reboot cycle. Without disconnect, the beacon stays connected and keeps flashing indefinitely. Added 200ms delay + explicit provisioner.disconnect() after writeConfig completes in the success path. Co-Authored-By: Claude Opus 4.6 (1M context) --- PayfritBeacon/Views/ScanView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PayfritBeacon/Views/ScanView.swift b/PayfritBeacon/Views/ScanView.swift index 33601b2..5b61d3a 100644 --- a/PayfritBeacon/Views/ScanView.swift +++ b/PayfritBeacon/Views/ScanView.swift @@ -698,7 +698,11 @@ struct ScanView: View { try await provisioner.writeConfig(config) writesCompleted = true - // No explicit disconnect needed — succeed() already disconnects + + // Give the beacon 200ms to process SaveConfig before dropping the BLE link. + // The beacon MCU needs the connection terminated to finalize its reboot/save cycle. + try? await Task.sleep(nanoseconds: 200_000_000) + provisioner.disconnect() try await APIClient.shared.registerBeaconHardware( businessId: business.id,