BLE 연결이 끊어지는 경우 비동기 측정 상태로 인한 먹통 현상 방지
- main.c: BLE disconnected -> maa_async_abort() 함수 호출 - dr_adc121s051c: maa_async_abort() 함수에서 상태를 IDLE로 초기화 및 정리
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user