diff --git a/libraries/BLE/src/BLECharacteristic.cpp b/libraries/BLE/src/BLECharacteristic.cpp index 95966cc759e..9b75f5b51a2 100644 --- a/libraries/BLE/src/BLECharacteristic.cpp +++ b/libraries/BLE/src/BLECharacteristic.cpp @@ -628,7 +628,9 @@ void BLECharacteristic::setValue(uint8_t* data, size_t length) { log_e("Size %d too large, must be no bigger than %d", length, ESP_GATT_MAX_ATTR_LEN); return; } + m_semaphoreSetValue.take(); m_value.setValue(data, length); + m_semaphoreSetValue.give(); log_v("<< setValue"); } // setValue diff --git a/libraries/BLE/src/BLECharacteristic.h b/libraries/BLE/src/BLECharacteristic.h index 5eb1e8d6dde..dd65cc4b8c4 100644 --- a/libraries/BLE/src/BLECharacteristic.h +++ b/libraries/BLE/src/BLECharacteristic.h @@ -117,6 +117,7 @@ class BLECharacteristic { void setHandle(uint16_t handle); FreeRTOS::Semaphore m_semaphoreCreateEvt = FreeRTOS::Semaphore("CreateEvt"); FreeRTOS::Semaphore m_semaphoreConfEvt = FreeRTOS::Semaphore("ConfEvt"); + FreeRTOS::Semaphore m_semaphoreSetValue = FreeRTOS::Semaphore("SetValue"); }; // BLECharacteristic