|
|
|
@@ -42,7 +42,6 @@ int cmd_mbb(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
int16_t gyro[3];
|
|
|
|
|
|
|
|
|
|
processing = true;
|
|
|
|
|
power_button_suspend(true);
|
|
|
|
|
DBG_PRINTF("[MBB] cmd start\r\n");
|
|
|
|
|
|
|
|
|
|
int batt_mv = -1;
|
|
|
|
@@ -77,7 +76,6 @@ int cmd_mbb(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
DBG_PRINTF("[MBB] done\r\n");
|
|
|
|
|
cmd_send_response_u16("raa:", (uint16_t)status); // 최종 상태 raa: 전송
|
|
|
|
|
DBG_PRINTF("[CMD] mbb status=0x%04X\r\n", status);
|
|
|
|
@@ -107,7 +105,6 @@ int cmd_mtb(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
bool fifo_started = false;
|
|
|
|
|
|
|
|
|
|
processing = true;
|
|
|
|
|
power_button_suspend(true);
|
|
|
|
|
DBG_PRINTF("[MTB] cmd start\r\n");
|
|
|
|
|
|
|
|
|
|
int imu_ret = imu_fifo_start();
|
|
|
|
@@ -155,7 +152,6 @@ int cmd_mtb(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
DBG_PRINTF("[CMD] mtb status=0x%04X\r\n", status);
|
|
|
|
|
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
DBG_PRINTF("[CMD] mtb status=0x%04X rim=%u\r\n", status, rim_count);
|
|
|
|
|
|
|
|
|
|
processing = false;
|
|
|
|
@@ -221,12 +217,20 @@ int cmd_mim(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
ARG_UNUSED(data);
|
|
|
|
|
ARG_UNUSED(data_len);
|
|
|
|
|
|
|
|
|
|
if (processing)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processing = true;
|
|
|
|
|
|
|
|
|
|
uint16_t rim_count = 0U;
|
|
|
|
|
int imu_ret = imu_fifo_start();
|
|
|
|
|
if (imu_ret != 0)
|
|
|
|
|
{
|
|
|
|
|
DBG_PRINTF("[MTB] fifo start fail ret=%d\r\n", imu_ret);
|
|
|
|
|
cmd_send_response_rim(tx_rim_samples, 0U);
|
|
|
|
|
processing = false;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -241,6 +245,7 @@ int cmd_mim(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
|
|
|
|
|
cmd_send_response_rim(tx_rim_samples, rim_count); // IMU FIFO 15 samples rim: 전송
|
|
|
|
|
imu_fifo_stop();
|
|
|
|
|
processing = false;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -261,7 +266,6 @@ int cmd_maa(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
uint8_t session = cmd_next_echo_session();
|
|
|
|
|
|
|
|
|
|
processing = true;
|
|
|
|
|
power_button_suspend(true);
|
|
|
|
|
|
|
|
|
|
int status = piezo_measure_start_session();
|
|
|
|
|
|
|
|
|
@@ -280,7 +284,6 @@ int cmd_maa(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
cmd_send_response_u16("raa:", (uint16_t)status); // 최종 상태 raa: 전송
|
|
|
|
|
DBG_PRINTF("[CMD] maa status=0x%04X\r\n", status);
|
|
|
|
|
|
|
|
|
@@ -359,11 +362,9 @@ int cmd_mpc(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
power_button_suspend(true);
|
|
|
|
|
|
|
|
|
|
if (piezo_init() != 0)
|
|
|
|
|
{
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
cmd_send_response_u16("rpc:", 0);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
@@ -373,14 +374,12 @@ int cmd_mpc(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
if (piezo_select_channel((uint8_t)(piezo_ch % PIEZO_NUM_CHANNELS)) != 0)
|
|
|
|
|
{
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
cmd_send_response_u16("rpc:", 0);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
piezo_burst_sw_freq((uint8_t)freq_option, cycles);
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
|
|
|
|
|
cmd_send_response_u16("rpc:", cycles);
|
|
|
|
|
return 1;
|
|
|
|
@@ -422,7 +421,6 @@ int cmd_mec(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processing = true;
|
|
|
|
|
power_button_suspend(true);
|
|
|
|
|
|
|
|
|
|
int status = piezo_measure_start_session();
|
|
|
|
|
if (status == ECHO_STATUS_OK)
|
|
|
|
@@ -436,7 +434,6 @@ int cmd_mec(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
cmd_send_response_u16("raa:", (uint16_t)status);
|
|
|
|
|
processing = false;
|
|
|
|
|
return 1;
|
|
|
|
@@ -468,7 +465,6 @@ int cmd_mad(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processing = true;
|
|
|
|
|
power_button_suspend(true);
|
|
|
|
|
|
|
|
|
|
int status = piezo_measure_start_session();
|
|
|
|
|
if (status == ECHO_STATUS_OK)
|
|
|
|
@@ -482,7 +478,6 @@ int cmd_mad(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
piezo_power_off();
|
|
|
|
|
power_button_suspend(false);
|
|
|
|
|
cmd_send_response_u16("raa:", (uint16_t)status);
|
|
|
|
|
DBG_PRINTF("[CMD] mad status=0x%04X ch=%u samples=%u avg=%u\r\n",
|
|
|
|
|
status,
|
|
|
|
@@ -492,4 +487,4 @@ int cmd_mad(const uint8_t *data, uint8_t data_len)
|
|
|
|
|
|
|
|
|
|
processing = false;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|