Skip to content

Commit 098a007

Browse files
authored
MI32: fix onStatus(), improve stability for Matter network commissioning via Bluetooth (#24139)
1 parent 83a97fa commit 098a007

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,12 @@ class MI32CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
236236
BLERingBufferItem_t header;
237237
uint8_t buffer[4];
238238
} item;
239-
item.header.length = 4;
239+
item.header.length = sizeof(item.buffer);
240240
item.header.type = BLE_OP_ON_STATUS;
241241
item.header.returnCharUUID = *(uint16_t*)pCharacteristic->getUUID().getValue();
242242
item.header.handle = pCharacteristic->getHandle();
243-
xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + 4, pdMS_TO_TICKS(1));
243+
memcpy(item.buffer,&code,item.header.length);
244+
xRingbufferSend(BLERingBufferQueue, (const void*)&item, sizeof(BLERingBufferItem_t) + item.header.length, pdMS_TO_TICKS(1));
244245
};
245246

246247
void onSubscribe(NimBLECharacteristic* pCharacteristic, NimBLEConnInfo& connInfo, uint16_t subValue) {
@@ -1539,7 +1540,7 @@ void MI32ConnectionTask(void *pvParameters){
15391540
bool MI32StartServerTask(){
15401541
AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: Server task ... start"));
15411542
if (BLERingBufferQueue == nullptr){
1542-
BLERingBufferQueue = xRingbufferCreate(2048, RINGBUF_TYPE_NOSPLIT);
1543+
BLERingBufferQueue = xRingbufferCreate(4096, RINGBUF_TYPE_NOSPLIT);
15431544
if(!BLERingBufferQueue) {
15441545
AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed to create ringbuffer queue"));
15451546
return false;

0 commit comments

Comments
 (0)