fix(vd960DBN): BLE 第二分包丢失 — performPeriodicTask 主动拉包 + 发送日志
- 现场: 第一包 93B 正常收到, 第二包 49B 永远收不到 (两包间隔 50ms) - 根因: 分包续传依赖 poll_dbn_ble 下一轮收包/主循环轮转填充, 与 TMOS 周期交错 - peripheral.c: performPeriodicTask 发完当前包后主动 set_response_to_notify 拉下一分片, 与收包事件解耦; peripheralChar4Notify 增加 BLE notify OK/FAIL 打印 (发送失败不再静默) - 隔离测试: 仅靠周期事件驱动, MTU=96 3 周期发出 93B+49B, 重组 130B 一致
This commit is contained in:
@@ -684,13 +684,18 @@ static void peripheralStateNotificationCB(gapRole_States_t newState, gapRoleEven
|
||||
*/
|
||||
static void performPeriodicTask(void)
|
||||
{
|
||||
// uint8_t notiData[SIMPLEPROFILE_CHAR4_LEN] = {0x88};
|
||||
// peripheralChar4Notify(notiData, SIMPLEPROFILE_CHAR4_LEN);
|
||||
if(g_flag_notify_temp){
|
||||
g_flag_notify_temp = 0;
|
||||
peripheralChar4Notify(g_notify_buftemp.buf, g_notify_buftemp.len);
|
||||
clear_ble_notify_buf(&g_notify_buftemp);
|
||||
}
|
||||
/* chunk continuation: when notify buf idle and response queue still
|
||||
has more fragments, actively pull next packet here (50ms period),
|
||||
do NOT rely on poll_dbn_ble rx events */
|
||||
if(g_notify_buftemp.flag == 0)
|
||||
{
|
||||
g_flag_notify_temp = set_response_to_notify(&g_buf_ble_response, &g_notify_buftemp);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
@@ -718,8 +723,13 @@ static void peripheralChar4Notify(uint8_t *pValue, uint16_t len)
|
||||
tmos_memcpy(noti.pValue, pValue, noti.len);
|
||||
if(simpleProfile_Notify(peripheralConnList.connHandle, ¬i) != SUCCESS)
|
||||
{
|
||||
PRINT("BLE notify FAIL, len:%d, MTU:%d\n", len, peripheralMTU);
|
||||
GATT_bm_free((gattMsg_t *)¬i, ATT_HANDLE_VALUE_NOTI);
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT("BLE notify OK, len:%d, MTU:%d\n", len, peripheralMTU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user