maa samples 140->100 변경, mec/maa 수신 시 Piezo 자동 Active/Sleep

- MAA_NUM_SAMPLES 140에서 100으로 변경 (DR_ADC_ECHO_SAMPLES_MAX 제한)
- 단일(mec) 및 모든 채널(maa) 에코 캡처 명령 수신 시 Piezo 자동 Active, 응답 송신 후 Sleep
- Cmd_mpa 중복 호출 정리 (dr_piezo_system_init 내부에 power_on 포함)
- 채널별 디버그 로그 추가
- 코드 리뷰 주석 정리 및 기타 파일 업데이트

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jhChun
2026-03-17 18:03:04 +09:00
parent 39b4ffe66a
commit 96a46a26dd
29 changed files with 1474 additions and 501 deletions

View File

@@ -49,6 +49,9 @@ extern void dr_piezo_burst_sw_20mhz(uint8_t cycles);
extern void dr_piezo_burst_sw_17mhz(uint8_t cycles);
extern void dr_piezo_burst_sw_22mhz(uint8_t cycles);
extern void dr_piezo_burst_sw_19mhz(uint8_t cycles);
extern void dr_piezo_power_off(void);
#include "parser.h"
/*==============================================================================
* DEBUG CONFIGURATION
@@ -791,7 +794,7 @@ dr_adc_err_t dr_adc_burst_capture_transmit(uint8_t freq_option, uint16_t delay_u
if (cycles < 3 || cycles > 9) cycles = 5; /* Valid range: 3~9, default 5 */
if (averaging == 0) averaging = 1; /* Minimum 1 */
if (averaging > 1000) averaging = 1000; /* Maximum 1000 */
if (piezo_ch > 7) piezo_ch = 0; /* Validate piezo channel: 0~7 jhChun 26.01.29 */
if (piezo_ch >= MAA_NUM_CHANNELS) piezo_ch = 0; /* 채널 범위 검증 */
dr_adc_echo_t echo;
echo.peak_raw = 0;
@@ -1325,6 +1328,8 @@ static dr_adc_err_t maa_async_capture_channel(uint8_t ch)
{
if (ch > (MAA_NUM_CHANNELS - 1)) return DR_ADC_ERR_INVALID_PARAM;
if (g_plat.log) g_plat.log("[maa] capturing CH%u\r\n", ch);
return dr_adc_capture_channel_only(
g_maa_ctx.freq_option,
g_maa_ctx.delay_us,
@@ -1434,6 +1439,13 @@ static void maa_async_send_completion(uint16_t status)
dr_binary_tx_safe(buf, 3);
/* 자동으로 켰으면 완료 후 전원 OFF */
if (g_maa_ctx.auto_powered) {
if (g_plat.log) g_plat.log("[Cmd_maa] TX/RX Active -> Sleep\r\n");
dr_piezo_power_off();
g_maa_ctx.auto_powered = false;
}
g_maa_ctx.state = MAA_ASYNC_IDLE;
ADC_LOG("maa_async: complete, status=0x%04X", status);
}
@@ -1551,3 +1563,8 @@ void maa_async_abort(void)
}
}
void maa_async_set_auto_power(bool on)
{
g_maa_ctx.auto_powered = on;
}