|
@@ -466,7 +466,7 @@ void updateStatusLed() {
|
|
|
|
|
|
|
|
class ServerCallbacks : public BLEServerCallbacks {
|
|
class ServerCallbacks : public BLEServerCallbacks {
|
|
|
void onConnect(BLEServer* s) { bleDeviceConnected = true; Serial.println("BLE connected."); }
|
|
void onConnect(BLEServer* s) { bleDeviceConnected = true; Serial.println("BLE connected."); }
|
|
|
- void onDisconnect(BLEServer* s) { bleDeviceConnected = false; Serial.println("BLE disconnected."); BLEDevice::startAdvertising(); }
|
|
|
|
|
|
|
+ void onDisconnect(BLEServer* s) { bleDeviceConnected = false; Serial.println("BLE disconnected."); delay(100); BLEDevice::startAdvertising(); }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
class ModeCharCallbacks : public BLECharacteristicCallbacks {
|
|
class ModeCharCallbacks : public BLECharacteristicCallbacks {
|
|
@@ -500,8 +500,8 @@ void setupBLE() {
|
|
|
BLEAdvertising* pAdvertising = BLEDevice::getAdvertising();
|
|
BLEAdvertising* pAdvertising = BLEDevice::getAdvertising();
|
|
|
pAdvertising->addServiceUUID(SERVICE_UUID);
|
|
pAdvertising->addServiceUUID(SERVICE_UUID);
|
|
|
pAdvertising->setScanResponse(true);
|
|
pAdvertising->setScanResponse(true);
|
|
|
- pAdvertising->setMinPreferred(0x06);
|
|
|
|
|
- pAdvertising->setMinPreferred(0x12);
|
|
|
|
|
|
|
+ pAdvertising->setMinPreferred(0x0c);
|
|
|
|
|
+ pAdvertising->setMaxPreferred(0x18);
|
|
|
BLEDevice::startAdvertising();
|
|
BLEDevice::startAdvertising();
|
|
|
Serial.println("BLE advertising.");
|
|
Serial.println("BLE advertising.");
|
|
|
}
|
|
}
|