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) <noreply@anthropic.com>
This commit is contained in:
Schwifty 2026-03-23 04:04:45 +00:00
parent 640bc32f92
commit a08d3db893

View file

@ -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,