From 3f07065de2f4dd9194298828d1d96a85acc91307 Mon Sep 17 00:00:00 2001 From: jhChun Date: Tue, 24 Mar 2026 18:18:52 +0900 Subject: [PATCH] =?UTF-8?q?BLE=20=EC=97=B0=EA=B2=B0=EC=9D=B4=20=EB=81=8A?= =?UTF-8?q?=EC=96=B4=EC=A7=80=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EB=B9=84?= =?UTF-8?q?=EB=8F=99=EA=B8=B0=20=EC=B8=A1=EC=A0=95=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EB=A8=B9=ED=86=B5=20=ED=98=84?= =?UTF-8?q?=EC=83=81=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - main.c: BLE disconnected -> maa_async_abort() 함수 호출 - dr_adc121s051c: maa_async_abort() 함수에서 상태를 IDLE로 초기화 및 정리 --- pc_firm/dr_adc121s051/dr_adc121s051.c | 10 ++++++++-- project/ble_peripheral/ble_app_bladder_patch/main.c | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pc_firm/dr_adc121s051/dr_adc121s051.c b/pc_firm/dr_adc121s051/dr_adc121s051.c index cc6a58d..d59c444 100644 --- a/pc_firm/dr_adc121s051/dr_adc121s051.c +++ b/pc_firm/dr_adc121s051/dr_adc121s051.c @@ -1388,11 +1388,17 @@ maa_async_state_t maa_async_get_state(void) return g_maa_ctx.state; } +/*============================================================================== + * 비동기 측정 상태 IDLE로 초기화 - BLE 연결이 끊어지는 경우 먹통 현상 방지 + *============================================================================*/ void maa_async_abort(void) { - if (g_maa_ctx.state != MAA_ASYNC_IDLE) { + if (g_maa_ctx.state != MAA_ASYNC_IDLE) + { ADC_LOG("maa_async_abort: aborting from state %d", g_maa_ctx.state); - g_maa_ctx.state = MAA_ASYNC_IDLE; + g_maa_ctx.state = MAA_ASYNC_IDLE; // 측정 상태 IDLE로 초기화 + g_maa_ctx.on_complete_cb = NULL; // abort 후 콜백 호출 방지 + dr_piezo_power_off(); // 전체 측정 중간에 끊기는 경우 Piezo TX/RX Sleep } } diff --git a/project/ble_peripheral/ble_app_bladder_patch/main.c b/project/ble_peripheral/ble_app_bladder_patch/main.c index 52a17d3..968d250 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/main.c +++ b/project/ble_peripheral/ble_app_bladder_patch/main.c @@ -1032,11 +1032,14 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) switch (p_ble_evt->header.evt_id) { + /* BLE 연결이 끊어지는 경우 */ case BLE_GAP_EVT_DISCONNECTED: DBG_PRINTF("[BLE] Disconnected\r\n"); ble_connection_st = 0; m_conn_handle = BLE_CONN_HANDLE_INVALID; m_tx_in_progress = false; + + maa_async_abort(); // 비동기 측정 상태에 의한 먹통 현상 방지 if (device_status == true) {