Open vovagorodok opened 9 months ago
Can't find the reason in ArduinoBLE code. Any idea why it happens? In the same scenario with NimBLE-Arduino lib I have one notification. With this issue I can't implement ArduinoBleOTA lib correctly
Hi! I faced a similar issue. After some investigations, I suppressed echoing data back to the client.
To implement this change you need to add BLEWriteWithoutResponse
to the BLE Characteristics permissions and update code for void BLELocalCharacteristic::writeValue(BLEDevice device, const uint8_t value[], int length)
function in src/local/BLELocalCharacteristic.cpp
file.
--- a/src/local/BLELocalCharacteristic.cpp
+++ b/src/local/BLELocalCharacteristic.cpp
@@ -223,7 +223,17 @@ void BLELocalCharacteristic::writeValue(BLEDevice device, const uint8_t value[],
{
_written = true;
- writeValue(value, length);
+ if (_properties & BLEWriteWithoutResponse) {
+ _valueLength = min(length, _valueSize);
+ memcpy(_value, value, _valueLength);
+
+ if (_fixedLength) {
+ _valueLength = _valueSize;
+ }
+ }
+ else {
+ writeValue(value, length);
+ }
if (_eventHandlers[BLEWritten]) {
_eventHandlers[BLEWritten](device, BLECharacteristic(this));
In https://github.com/vovagorodok/ArduinoBleOTA/blob/main/src/ArduinoBleOtaClass.cpp:
notifies twice about written value. Checked on esp32dev and nano_33_iot