-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Auto reconnect #405
Auto reconnect #405
Conversation
limited testing - it works pretty good so far. I'll try a regular ride with it here and make sure all is okay, then we should do some exception testing. |
Working well so far. one potential issue that needs to be addressed is if you have a device configured (i.e. a hr monitor) and the battery were to go dead mid ride, the remaining BLE communication to the client nd server is severely disrupted as it attempts reconnects. I think I might be able to find a solution for this. |
It's better by increasing the connection timeout and decreasing the scan time. The issue is the initial scan needs to be fairly long to catch all devices on the first try. I think I can get it without interruption if I separate the scan times into two different timings. Say a 3 second scan for this method, and a 10 second scan time for other processes. At 3 seconds, we may not catch the device we're looking for on the first scan but this isn't an issue since we automatically re-scan. |
fixed this. new binary vv |
Bench test seems to work well. Test procedure: power on PM - SS2K reconnected automatically within ~30 seconds. |
Test #2: Ride in Mywhoosh with PM & HRM |
Tested the re-connect feature with my Echelon Sport: Steps Taken:
|
Nice! Is this ready to be merged into Develop or should we make changes or require further testing? |
The only 'weird' thing I noticed was that my bike's name didn't show up under power. Even though it connected, the name didn't show up on the dropdown. IMO it works. Send it! |
Thx! The BLE names are a little different issue I’ll have to fix in the http server. Right now they’re read from only the variable that holds devices found during the (last) scan. If a device is actively connected, it won’t be found during the scan. I think I could fix this by simply adding saved devices to that string before sending. It will occasionally result in duplicates in the list but that’s better than the problem you describe. |
@d-nx & @eMadman , I fixed bluetooth scanner.html according to the issue by @d-nx . In order to test it, you can manually upload bluetoothscanner.html from this branch via the firmware updater web page. https://github.com/doudar/SmartSpin2k/blob/auto_reconnect/data/bluetoothscanner.html |
I updated the .html file but I'm still seeing the same issue: |
Ahh! Thanks for the picture. I remember this issue now. It's because the html is only looking for the cycling power characteristic for PMs. Since you have an Echelon, it's not getting added to the drop-down. I think this is an easy fix. I'll see if I can add it tonight. |
@d-nx , please let me know if this displays your Echelon after uploading the bluetoothscanner.html. You'll probably need to reboot as well to clear any active connections. https://github.com/doudar/SmartSpin2k/blob/auto_reconnect/data/bluetoothscanner.html |
It's working a bit better but now I have some duplicates: Cleared active connections, rebooted but still see doubles. |
Also, it's not allowing me to select 'none' so I can disconnect from the bike. |
I can't seem to duplicate this - is there a certain browser you're using? I've tried on Windows Chrome, Edge, and IPhone Safari and Chrome. As far as the duplicates, I'll have to write a javascript loop in bluetoothscanner.html to remove duplicates in the list. I'm not too concerned about it. Super happy the Echelon is showing on the list for you. That was an easy fix. |
I'm using Chrome. The behaviour is as follows: I connect to the bike by selecting "Any" then "Save Dropdowns", after that the bike beeps confirming connection and the name appears on the dropdown menu of SS2K. Now, I would like to select "None" so the bike disconnects from SS2K (So I can use with a different app), but after hitting "Save Dropdowns" it's still connected. Maybe this has something to do with the new reconnect feature? not sure how to make ss2k disconnect from the bike at this point. |
Okay, so it will save "none" but the bike doesn't disconnect, correct? Does it disconnect (and stay disconnected) if you reboot the SS2K after selecting none? |
It doesn't save 'none' the echelon remains selected in the dropdown. Ant the bike remains connected to ss2k. Selecting "None" then "Saving Dropdown" = Echelon remains in the dropdown list, and bike remains connected. |
Thanks! I’ll see if I can work on that. I might just have it reboot if none is selected. |
@d-nx I've changed it so that whenever a BLE device is selected that's different from the currently connected one it will reboot to apply the settings. It's the easiest way to apply the changes that need to be done and it happens pretty fast as long as the WiFi doesn't take a long time to reconnect. Newest binary attached. |
@eMadman see above - any comments? |
@doudar device reboots when selecting "None" from the dropdown then quickly finds an available connection. Seems to be working as intended |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed testing on bench and bike
This will attempt a scan/connect if no devices are set to "any" and any device NOT set to "none" is disconnected. Interval between scans is ~30 seconds.
Here's an initial firmware. Not much testing done yet. So far it seems to scan occasionally and not crash :)
As always, extract the firmware.zip, admin/admin and make sure it's named exactly firmware.bin for upload.
edit: see comments below for the latest build of the firmware from this branch.