Add periodic keep-alive to prevent cameras from silently sleeping#76
Merged
Add periodic keep-alive to prevent cameras from silently sleeping#76
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>
19aad9b to
889c85f
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>
Group status now reflects the least-progressed camera in the group, making the state progression predictable: disconnected → connecting → initializing → ready. Errors and recording override since they require immediate attention. The status message continues to show the detailed per-state breakdown. Co-authored-by: Cursor <cursoragent@cursor.com>
GoPro cameras auto-sleep when both the Auto Power Down and Keep Alive timers expire. Without periodic keep-alive messages, connected cameras could silently enter sleep while the app still considered them active, leading to an invalid state that also affected USB connectivity. Sends Keep Alive (0x5B) to all connected cameras every 3 seconds via the Settings characteristic, per Open GoPro API best practices. The timer starts when the first camera connects and stops on last disconnect or before explicit sleep/power-down commands. Co-authored-by: Cursor <cursoragent@cursor.com>
889c85f to
bb89732
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
Test plan
Made with Cursor