File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -161,9 +161,9 @@ bool BLEApi::connect(BLEPeripheralID id)
161
161
bool connected = false ;
162
162
int8_t retry = 5 ;
163
163
log_i (" Connect attempt start" );
164
+ peripheral = BLEDevice::createClient ();
164
165
do
165
166
{
166
- peripheral = BLEDevice::createClient ();
167
167
// TODO: sometimes the connect fails and remains hanging in the semaphore, patch BLE lib ?
168
168
// ----------------------------
169
169
// Connect attempt start
@@ -180,8 +180,8 @@ bool BLEApi::connect(BLEPeripheralID id)
180
180
}
181
181
else
182
182
{
183
- log_d (" Removing peripheral" );
184
- delete peripheral;
183
+ // log_d("Removing peripheral");
184
+ // delete peripheral;
185
185
if (retry > 0 )
186
186
{
187
187
log_i (" Retry connection in 1s" );
@@ -196,6 +196,8 @@ bool BLEApi::connect(BLEPeripheralID id)
196
196
}
197
197
else
198
198
{
199
+ log_d (" Removing peripheral" );
200
+ delete peripheral;
199
201
log_e (" Could not connect to [%s][%d]\n " , address.toString ().c_str (), retry);
200
202
}
201
203
return connected;
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ void NobleApi::init()
44
44
BLEApi::onDeviceDisconnected (onBLEDeviceDisconnected);
45
45
BLEApi::onCharacteristicNotification (onCharacteristicNotification);
46
46
ws = new WebSocketsServer (ESP_GW_WEBSOCKET_PORT);
47
- ws->enableHeartbeat (10000 , 2000 , 1 );
47
+ ws->enableHeartbeat (30000 , 5000 , 3 );
48
48
ws->begin ();
49
49
ws->onEvent (onWsEvent);
50
50
}
You can’t perform that action at this time.
0 commit comments