Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bluetooth connection disconnect handling #74

Merged

Conversation

matthudsonau
Copy link
Contributor

Monitors the Bluetooth connection status for the device and attempts an automatic reconnect whenever the connection drops

Some changes requires to M5ez to add functionality to get the current buttons

Device class is also updated to support querying connection status

matthudsonau and others added 4 commits March 6, 2024 20:37
This allows the event function to have context on call and avoid
requiring global variables to maintain state.
@gkoh gkoh self-requested a review March 7, 2024 12:08
@gkoh
Copy link
Owner

gkoh commented Mar 8, 2024

@matthudsonau OK, I've refactored the context blahs to completely remove the global variables. I'll be using this in a future refactor to try and make the UI code less messy.

In testing I found the reconnection to work well, good job!

However, if the reconnection fails, bad things happen.
Specifically, if I switch off the camera (and leave it off) whilst connected, the reconnecting progress bar is either:

permanently stalled OR
screen blanks
It looks like it exits either remote_control() or remote_interval() and ends up stuck in menu_remote() in the runOnce()) call and doesn't redraw the screen.

Are you able to look into it?

@matthudsonau
Copy link
Contributor Author

Yeah, I'll have a run at it tonight. Although the easiest way to fix it is probably just resetting the program if the connection doesn't restore

@gkoh
Copy link
Owner

gkoh commented Mar 8, 2024

Yeah, I'll have a run at it tonight. Although the easiest way to fix it is probably just resetting the program if the connection doesn't restore

This absolutely the right answer and have implemented it, thanks!

@gkoh gkoh added this to the v2.0.0 milestone Mar 8, 2024
@gkoh gkoh linked an issue Mar 8, 2024 that may be closed by this pull request
@gkoh gkoh merged commit 792be21 into gkoh:master Mar 8, 2024
6 checks passed
@gkoh
Copy link
Owner

gkoh commented Mar 8, 2024

LGTM, merged!

@matthudsonau matthudsonau deleted the add-bluetooth-connection-disconnect-handling branch March 8, 2024 02:44
@matthudsonau matthudsonau restored the add-bluetooth-connection-disconnect-handling branch March 8, 2024 02:44
@matthudsonau matthudsonau deleted the add-bluetooth-connection-disconnect-handling branch March 8, 2024 02:44
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.

Handle Bluetooth connection dropping
2 participants