Skip to content

Commit ebe18da

Browse files
RobertoRoberto
authored andcommitted
1 parent dad42b4 commit ebe18da

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/hardware/BLEMIDI_Client_ESP32.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
*
7676
* Uncomment what you need
7777
* These are the default values.
78+
* You can select some simultaneously.
7879
*/
7980
#define BLEMIDI_CLIENT_BOND
8081
//#define BLEMIDI_CLIENT_MITM
@@ -86,7 +87,7 @@
8687
*/
8788
static uint32_t userOnPassKeyRequest()
8889
{
89-
//FILL WITH YOUR CUSTOM AUTH METHOD or PASSKEY
90+
//FILL WITH YOUR CUSTOM AUTH METHOD CODE or PASSKEY
9091
//FOR EXAMPLE:
9192
uint32_t passkey = 123456;
9293

@@ -96,7 +97,7 @@ static uint32_t userOnPassKeyRequest()
9697
return passkey;
9798
};
9899

99-
/*
100+
/*
100101
###### BLE COMMUNICATION PARAMS ######
101102
*/
102103
/** Set connection parameters:
@@ -128,7 +129,7 @@ static uint32_t userOnPassKeyRequest()
128129
* Uncomment this define if your device doesn't work propertily after a reconnection.
129130
*
130131
*/
131-
#define BLEMIDI_FORCE_NEW_CONNECTION
132+
//#define BLEMIDI_FORCE_NEW_CONNECTION
132133

133134
/**
134135
*
@@ -355,12 +356,16 @@ class MyClientCallbacks : public BLEClientCallbacks
355356
if (_bluetoothEsp32)
356357
{
357358
_bluetoothEsp32->disconnected();
359+
#ifdef BLEMIDI_FORCE_NEW_CONNECTION
360+
// Try reconnection or search a new one
361+
_bluetoothEsp32->scan();
362+
#endif // BLEMIDI_FORCE_NEW_CONNECTION
358363
}
359364

360365
#ifdef BLEMIDI_FORCE_NEW_CONNECTION
361366
// Renew Client
362367
NimBLEDevice::deleteClient(pClient);
363-
//NimBLEDevice::createClient();
368+
NimBLEDevice::createClient();
364369
pClient = nullptr;
365370
#endif // BLEMIDI_FORCE_NEW_CONNECTION
366371

0 commit comments

Comments
 (0)