Skip to content

Conversation

@garthvh
Copy link
Member

@garthvh garthvh commented Jan 5, 2026

Don't append new devices to the list of discovered devices if the app is in the background, seems to cause crashes

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses crashes caused by appending new devices to the discovery list when the app is in the background. The solution introduces a background state flag that prevents device list modifications during background/inactive states.

Key Changes

  • Added isInBackground flag tracking in AccessoryManager based on scene phase
  • Version bumped from 2.7.6 to 2.7.7 across all targets

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Meshtastic/MeshtasticApp.swift Added logic to set accessoryManager.isInBackground flag when scene phase changes, preventing device discovery updates when app is not active
Meshtastic.xcodeproj/project.pbxproj Updated marketing version from 2.7.6 to 2.7.7 across all build configurations and targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@garthvh garthvh merged commit 487f24b into 2.7.7 Jan 5, 2026
2 checks passed
@garthvh garthvh deleted the accessorymanager-background-discovery branch January 5, 2026 04:38
@compumike
Copy link
Contributor

@garthvh FYI this change seems to break automatic reconnection when the app is in the background: shouldAutomaticallyConnectToPreferredPeripheral / connectToPreferredDevice relies on it being present in devices.

Test sequence:

  • connect to a node (BLE)
  • put app in background
  • reboot the node
  • watch the app logs

With this PR, it just stops at [Discovery] Found preferred peripheral and doesn't attempt to reconnect.

garthvh added a commit that referenced this pull request Jan 8, 2026
garthvh added a commit that referenced this pull request Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants