MUX 전환 후 ch0 더미 측정 6회 추가

- ch0,1,2에 발생하는 노이즈 해소를 위함
- 약 10ms 정도 측정 시간 증가
This commit is contained in:
2026-04-29 16:22:19 +09:00
parent d4ea134868
commit 6e7f935bac
@@ -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);