Add bt_music_sender_auto_reconnect.ino#776
Conversation
|
In the void BluetoothA2DPSource::start(std::vector<const char *> names) {
ESP_LOGD(BT_APP_TAG, "%s, ", __func__);
this->bt_names = names;
is_end = false;
is_autoreconnect_allowed = (reconnect_status == AutoReconnect);
init_nvs();
if (is_autoreconnect_allowed) {
// get last connection if not available
if (!has_last_connection()) {
get_last_connection();
}
}
:
}When This behavior may cause an issue on the initial run, since there is no stored connection to retrieve. |
|
I don't see any issue here: The only thing is, that the very first time you get some error messages because no last address exsists. In this case it is just connecting to the indicated name. |
|
Indeed, there seems to be nothing wrong with this source code. However, I couldn't get it to connect on my microcontroller no matter how many times I tried. What I'm looking for isn't an improvement to the source code. It's just a slightly overly detailed sample code. It reports that running |
|
This problem occurs especially when connecting to multiple devices. |
|
I agree, if you are not carefull with the parameters you try to reconnect (for a long time) to the last device which might not be available! |
|
I'm glad my intention was conveyed. I would really appreciate it if you could add a sample like the one I provided, or at least clearly state this in the comments of the sample. |
|
Here is my latest commit! |
|
Thank you for making the changes! |
|
I know this is a bit selfish, but I'd really appreciate it if you could also include this information in the A2DP Source documentation. That's where I encountered the problem. |
|
I extended the logic for the BluetoothA2DPSource set_auto_reconnect() to accept a retry count parameter to be consistent with the A2DP Sink implementation. Here is the related commit. |
|
Thank you so much for making changes to this great library based on my feedback!!! |
I wanted to enable auto reconnect.
Initially, I tried this:
But it turns out
set_auto_reconnect(true)should not be called beforestart().Posting this here in case it helps someone else with the same problem.