Reduce log noise, fix queue timer bug, and add auto-reconnect#74
Merged
Reduce log noise, fix queue timer bug, and add auto-reconnect#74
Conversation
GroupStatus.overallStatus incorrectly reported "Settings Mismatch" whenever cameras were disconnected, even if all connected cameras matched. Now it properly tracks per-camera settings/mode mismatch counts and only shows "Ready" when every camera in the group is accounted for. Also staggers recording commands (50ms apart) to reduce BLE congestion, logs encoding state transitions per camera, and downgrades mode mismatch check logging to DEBUG when no mismatches exist. Co-authored-by: Cursor <cursoragent@cursor.com>
965f487 to
6d8aec1
Compare
Add settingsMismatchCameras and modeMismatchCameras to GroupStatus init calls in test helper to match the updated struct. Co-authored-by: Cursor <cursoragent@cursor.com>
Fix command queue timer race condition where multiple timers were created for the same camera due to async timer creation, causing hundreds of spurious "queue is empty" messages. Timer creation is now synchronous on the main thread with proper invalidation of existing timers. Add auto-reconnect for cameras that drop unexpectedly while the group is in a connected state. Uses the existing straggler retry mechanism (up to 5 attempts, 15s interval). Intentional disconnects (sleep, power down) remove cameras from the target set to prevent unwanted reconnection. Also: handle GoPro status types 4/5 to eliminate "Unknown status type" spam, downgrade per-characteristic discovery and connection retry logs from INFO to DEBUG, and reduce connection timeout from 30s to 15s. Co-authored-by: Cursor <cursoragent@cursor.com>
6d8aec1 to
5b0adc7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
startCommandQueueTimerdeferred timer creation viaDispatchQueue.main.async, allowing multiple orphaned timers per camera. One camera alone generated 1,400+ spurious debug messages. Now creates timers synchronously with proper invalidation.targetConnectedCameras), the straggler retry timer restarts to reconnect it (up to 5 attempts, 15s interval). Intentional disconnects (sleep, power down, disconnect all) remove cameras from the target set.Test plan
Made with Cursor