- Piezo 6ch 측정 + 센서(배터리, IMU, 온도) 측정: mbb 명령어 추가
- Flash Memory Piezo 측정 파라미터 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -791,7 +791,7 @@ dr_adc_err_t dr_adc_burst_capture_transmit(uint8_t freq_option, uint16_t delay_u
|
||||
if (num_samples == 0 || num_samples > DR_ADC_ECHO_SAMPLES_MAX)
|
||||
return DR_ADC_ERR_INVALID_PARAM;
|
||||
if (freq_option > 9) freq_option = 0; /* Invalid -> default 1.8MHz */
|
||||
if (cycles < 3 || cycles > 9) cycles = 5; /* Valid range: 3~9, default 5 */
|
||||
if (cycles < 3 || cycles > 7) cycles = 5; /* Valid range: 3~7, default 5 */
|
||||
if (averaging == 0) averaging = 1; /* Minimum 1 */
|
||||
if (averaging > 1000) averaging = 1000; /* Maximum 1000 */
|
||||
if (piezo_ch >= MAA_NUM_CHANNELS) piezo_ch = 0; /* 채널 범위 검증 */
|
||||
@@ -1018,7 +1018,7 @@ dr_adc_err_t dr_adc_capture_channel_only(uint8_t freq_option, uint16_t delay_us,
|
||||
if (num_samples == 0 || num_samples > MAA_SAMPLES_MAX)
|
||||
return DR_ADC_ERR_INVALID_PARAM;
|
||||
if (freq_option > 3) freq_option = 0;
|
||||
if (cycles < 3 || cycles > 9) cycles = 5;
|
||||
if (cycles < 3 || cycles > 7) cycles = 5;
|
||||
if (averaging == 0) averaging = 1;
|
||||
if (averaging > 1000) averaging = 1000;
|
||||
if (piezo_ch > (MAA_NUM_CHANNELS - 1)) piezo_ch = 0;
|
||||
@@ -1448,6 +1448,13 @@ static void maa_async_send_completion(uint16_t status)
|
||||
|
||||
g_maa_ctx.state = MAA_ASYNC_IDLE;
|
||||
ADC_LOG("maa_async: complete, status=0x%04X", status);
|
||||
|
||||
/* 완료 콜백 호출 (mbb? 등에서 센서 측정 체인 트리거용) */
|
||||
if (g_maa_ctx.on_complete_cb) {
|
||||
void (*cb)(void) = g_maa_ctx.on_complete_cb;
|
||||
g_maa_ctx.on_complete_cb = NULL; /* 1회성: 재호출 방지 */
|
||||
cb();
|
||||
}
|
||||
}
|
||||
|
||||
/*==============================================================================
|
||||
@@ -1471,12 +1478,13 @@ dr_adc_err_t maa_async_start(uint8_t freq_option, uint16_t delay_us,
|
||||
g_maa_ctx.freq_option = freq_option;
|
||||
g_maa_ctx.delay_us = delay_us;
|
||||
g_maa_ctx.num_samples = num_samples;
|
||||
g_maa_ctx.cycles = (cycles < 3 || cycles > 9) ? 5 : cycles;
|
||||
g_maa_ctx.cycles = (cycles < 3 || cycles > 7) ? 5 : cycles;
|
||||
g_maa_ctx.averaging = (averaging == 0) ? 1 : ((averaging > 1000) ? 1000 : averaging);
|
||||
g_maa_ctx.ble_buffer = ble_buffer;
|
||||
g_maa_ctx.current_ch = 0;
|
||||
g_maa_ctx.current_pkt = 0;
|
||||
g_maa_ctx.data_offset = 0;
|
||||
g_maa_ctx.on_complete_cb = NULL; /* 기본: 콜백 없음 (maa?) */
|
||||
|
||||
ADC_LOG("maa_async_start: freq=%u delay=%u samples=%u cycles=%u avg=%u",
|
||||
freq_option, delay_us, num_samples, g_maa_ctx.cycles, g_maa_ctx.averaging);
|
||||
@@ -1568,3 +1576,8 @@ void maa_async_set_auto_power(bool on)
|
||||
g_maa_ctx.auto_powered = on;
|
||||
}
|
||||
|
||||
void maa_async_set_on_complete(void (*cb)(void))
|
||||
{
|
||||
g_maa_ctx.on_complete_cb = cb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user