From c30883b9b43aaea32fd711b5ffac3b8886d24222 Mon Sep 17 00:00:00 2001 From: jhchun Date: Fri, 12 Jun 2026 12:15:49 +0900 Subject: [PATCH] =?UTF-8?q?burst=20+=20delay=20+=20capture=20=EA=B5=AC?= =?UTF-8?q?=EA=B0=84=EC=97=90=20irq=5Flock()=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 각 채널마다 burst~capture 구간 1회 단위로 짧게 잠금 - 데이터를 그래프로 봤을 때 앞쪽으로 당겨지는 현상 보임 - Zephyr BLE controller/radio interrupt/다른 interrupt가 burst 이후 ADC capture 타이밍을 흔들어 샘플 시간축 jitter를 만드는 것으로 추정 - PC로 테스트했을 때, AVG=10인 경우에도 BLE 연결 끊김 없었으나 앱에서 확인 필요 --- src/parser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/parser.c b/src/parser.c index 5696d4c..b6af5a6 100644 --- a/src/parser.c +++ b/src/parser.c @@ -450,10 +450,12 @@ static int perform_piezo_sweep(void) k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US); } + unsigned int key = irq_lock(); piezo_burst_sw((uint8_t)cfg->cycles); k_busy_wait(capture_delay_us); err = echo_adc_capture(echo_capture, cfg->samples); + irq_unlock(key); if (err) { DBG_PRINTF("[ECHO] capture fail ch=%d avg=%d err=%d\r\n", ch, avg, err); @@ -537,10 +539,12 @@ static int perform_single_piezo_capture(uint8_t cycles, k_busy_wait(PIEZO_AVG_INTER_BURST_GAP_US); } + unsigned int key = irq_lock(); piezo_burst_sw(cycles); k_busy_wait(delay_us); err = echo_adc_capture(echo_capture, num_samples); + irq_unlock(key); if (err) { return ECHO_STATUS_CAPTURE;