burst + delay + capture 구간에 irq_lock() 적용
- 각 채널마다 burst~capture 구간 1회 단위로 짧게 잠금 - 데이터를 그래프로 봤을 때 앞쪽으로 당겨지는 현상 보임 - Zephyr BLE controller/radio interrupt/다른 interrupt가 burst 이후 ADC capture 타이밍을 흔들어 샘플 시간축 jitter를 만드는 것으로 추정 - PC로 테스트했을 때, AVG=10인 경우에도 BLE 연결 끊김 없었으나 앱에서 확인 필요
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user