BLE 명령 수신 시 Connection interval 재협상 요청 추가
- Windows BLE 스택이 장시간 연결 시 CI를 수초까지 늘려 응답이 지연되는 문제 대응 - 30초에 1회 20~75ms로 돌려달라고 요청
This commit is contained in:
@@ -609,7 +609,24 @@ static void nus_data_handler(ble_nus_evt_t * p_evt)
|
||||
{
|
||||
cmd_type_t = CMD_BLE;
|
||||
ble_got_new_data = true;
|
||||
|
||||
|
||||
/* Central이 연결 간격을 늘렸을 수 있으므로 빠른 간격 재요청 (30초에 1회) */
|
||||
{
|
||||
static uint32_t last_update_tick = 0;
|
||||
uint32_t now_tick = app_timer_cnt_get();
|
||||
if (last_update_tick == 0 ||
|
||||
app_timer_cnt_diff_compute(now_tick, last_update_tick) >= APP_TIMER_TICKS(30000))
|
||||
{
|
||||
ble_gap_conn_params_t conn_params;
|
||||
conn_params.min_conn_interval = MIN_CONN_INTERVAL;
|
||||
conn_params.max_conn_interval = MAX_CONN_INTERVAL;
|
||||
conn_params.slave_latency = SLAVE_LATENCY;
|
||||
conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;
|
||||
sd_ble_gap_conn_param_update(m_conn_handle, &conn_params);
|
||||
last_update_tick = now_tick;
|
||||
}
|
||||
}
|
||||
|
||||
/* 콜백에서는 복사만 하고, 메인 루프에서 처리 */
|
||||
if (p_evt->params.rx_data.length <= BLE_NUS_MAX_DATA_LEN)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user