piezo power on/off 시점 조정(전력 절감)
- on 구간 최소화
This commit is contained in:
@@ -64,7 +64,11 @@ int cmd_mbb(const uint8_t *data, uint8_t data_len)
|
|||||||
cmd_send_response_bundle((uint16_t)batt_mv, accel, gyro, temp_cdeg);
|
cmd_send_response_bundle((uint16_t)batt_mv, accel, gyro, temp_cdeg);
|
||||||
|
|
||||||
DBG_PRINTF("[MBB] piezo sweep start\r\n");
|
DBG_PRINTF("[MBB] piezo sweep start\r\n");
|
||||||
|
|
||||||
status = piezo_measure_sweep();
|
status = piezo_measure_sweep();
|
||||||
|
|
||||||
|
piezo_power_off();
|
||||||
|
|
||||||
if (status == ECHO_STATUS_OK)
|
if (status == ECHO_STATUS_OK)
|
||||||
{
|
{
|
||||||
for (uint8_t ch = 0; ch < PIEZO_NUM_CHANNELS; ch++)
|
for (uint8_t ch = 0; ch < PIEZO_NUM_CHANNELS; ch++)
|
||||||
@@ -75,7 +79,7 @@ int cmd_mbb(const uint8_t *data, uint8_t data_len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
piezo_power_off();
|
|
||||||
DBG_PRINTF("[MBB] done\r\n");
|
DBG_PRINTF("[MBB] done\r\n");
|
||||||
cmd_send_response_u16("raa:", (uint16_t)status); // 최종 상태 raa: 전송
|
cmd_send_response_u16("raa:", (uint16_t)status); // 최종 상태 raa: 전송
|
||||||
DBG_PRINTF("[CMD] mbb status=0x%04X\r\n", status);
|
DBG_PRINTF("[CMD] mbb status=0x%04X\r\n", status);
|
||||||
@@ -123,6 +127,9 @@ int cmd_mtb(const uint8_t *data, uint8_t data_len)
|
|||||||
{
|
{
|
||||||
DBG_PRINTF("[MTB] piezo sweep start\r\n");
|
DBG_PRINTF("[MTB] piezo sweep start\r\n");
|
||||||
status = piezo_measure_sweep();
|
status = piezo_measure_sweep();
|
||||||
|
|
||||||
|
piezo_power_off();
|
||||||
|
|
||||||
if (status == ECHO_STATUS_OK)
|
if (status == ECHO_STATUS_OK)
|
||||||
{
|
{
|
||||||
for (uint8_t ch = 0; ch < PIEZO_NUM_CHANNELS; ch++)
|
for (uint8_t ch = 0; ch < PIEZO_NUM_CHANNELS; ch++)
|
||||||
@@ -157,7 +164,6 @@ int cmd_mtb(const uint8_t *data, uint8_t data_len)
|
|||||||
}
|
}
|
||||||
DBG_PRINTF("[CMD] mtb status=0x%04X\r\n", status);
|
DBG_PRINTF("[CMD] mtb status=0x%04X\r\n", status);
|
||||||
|
|
||||||
piezo_power_off();
|
|
||||||
DBG_PRINTF("[CMD] mtb status=0x%04X rim=%u\r\n", status, rim_count);
|
DBG_PRINTF("[CMD] mtb status=0x%04X rim=%u\r\n", status, rim_count);
|
||||||
|
|
||||||
processing = false;
|
processing = false;
|
||||||
|
|||||||
@@ -167,9 +167,6 @@ int piezo_measure_start_session(void)
|
|||||||
return ECHO_STATUS_PIEZO;
|
return ECHO_STATUS_PIEZO;
|
||||||
}
|
}
|
||||||
|
|
||||||
piezo_power_on();
|
|
||||||
k_msleep(PIEZO_POWER_STABILIZE_MS);
|
|
||||||
|
|
||||||
err = echo_adc_init();
|
err = echo_adc_init();
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@@ -233,6 +230,9 @@ int piezo_measure_sweep(void)
|
|||||||
|
|
||||||
if (ch == 0U) // 채널 0 시작 전에만 dummy burst + ADC capture 수행
|
if (ch == 0U) // 채널 0 시작 전에만 dummy burst + ADC capture 수행
|
||||||
{
|
{
|
||||||
|
piezo_power_on();
|
||||||
|
k_msleep(PIEZO_POWER_STABILIZE_MS);
|
||||||
|
|
||||||
// Dummy burst + ADC caputre
|
// Dummy burst + ADC caputre
|
||||||
/*
|
/*
|
||||||
for (uint8_t dummy = 0; dummy < PIEZO_DUMMY_CAPTURE_COUNT; dummy++)
|
for (uint8_t dummy = 0; dummy < PIEZO_DUMMY_CAPTURE_COUNT; dummy++)
|
||||||
|
|||||||
Reference in New Issue
Block a user