From 6e7f935bac7944047d5137c8441472ef34370195 Mon Sep 17 00:00:00 2001 From: jhchun Date: Wed, 29 Apr 2026 16:22:19 +0900 Subject: [PATCH] =?UTF-8?q?MUX=20=EC=A0=84=ED=99=98=20=ED=9B=84=20ch0=20?= =?UTF-8?q?=EB=8D=94=EB=AF=B8=20=EC=B8=A1=EC=A0=95=206=ED=9A=8C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ch0,1,2에 발생하는 노이즈 해소를 위함 - 약 10ms 정도 측정 시간 증가 --- .../measurement/adc121s051/dr_adc121s051.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/project/ble_peripheral/ble_app_bladder_patch/measurement/adc121s051/dr_adc121s051.c b/project/ble_peripheral/ble_app_bladder_patch/measurement/adc121s051/dr_adc121s051.c index 9b43892..345e19f 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/measurement/adc121s051/dr_adc121s051.c +++ b/project/ble_peripheral/ble_app_bladder_patch/measurement/adc121s051/dr_adc121s051.c @@ -1274,6 +1274,7 @@ dr_adc_err_t maa_async_start(uint8_t freq_option, uint16_t delay_us, uint16_t nu { dr_adc_err_t err; uint8_t ch; + dr_maa_channel_t discard_channel; if (g_maa_ctx.state != MAA_ASYNC_IDLE) { @@ -1308,6 +1309,30 @@ dr_adc_err_t maa_async_start(uint8_t freq_option, uint16_t delay_us, uint16_t nu /* capture all channels without BLE TX, then start transmission */ g_maa_ctx.state = MAA_ASYNC_CAPTURING; + /* Warm up CH0 6 times and discard the results before the real capture starts. */ + for (uint8_t warmup = 0; warmup < 6; warmup++) + { + err = dr_adc_capture_channel_only( + g_maa_ctx.freq_option, + g_maa_ctx.delay_us, + g_maa_ctx.num_samples, + g_maa_ctx.cycles, + 1, + 0, + &discard_channel + ); + if (err != DR_ADC_OK) + { + if (g_plat.log) + { + g_plat.log("[maa] warmup CH0 failed (%d)", err); + } + dr_piezo_power_off(); + g_maa_ctx.state = MAA_ASYNC_IDLE; + return err; + } + } + for (ch = 0; ch < MAA_NUM_CHANNELS; ch++) { err = maa_async_capture_channel(ch);