Merge pull request #15254 from tony-fav/development-BLEOpChange

BLEOp only request response if char supports it
This commit is contained in:
Theo Arends 2022-03-30 14:36:10 +02:00 committed by GitHub
commit ace1961242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1990,7 +1990,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe
}
if (op->writelen){
if(pCharacteristic->canWrite() || pCharacteristic->canWriteNoResponse() ) {
if (!pCharacteristic->writeValue(op->dataToWrite, op->writelen, true)){
if (!pCharacteristic->writeValue(op->dataToWrite, op->writelen, !pCharacteristic->canWriteNoResponse())){ // request response, unless we can't
newstate = GEN_STATE_FAILED_WRITE;
#ifdef BLE_ESP32_DEBUG
AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: characteristic write fail"));
@ -3720,5 +3720,3 @@ void sendExample(){
#endif
#endif // CONFIG_IDF_TARGET_ESP32 or CONFIG_IDF_TARGET_ESP32C3
#endif // ESP32