diff --git a/src/command/handlers/cmd_piezo.c b/src/command/handlers/cmd_piezo.c index a90ce48..3e7d3d7 100644 --- a/src/command/handlers/cmd_piezo.c +++ b/src/command/handlers/cmd_piezo.c @@ -221,12 +221,22 @@ int cmd_mim(const uint8_t *data, uint8_t data_len) ARG_UNUSED(data); ARG_UNUSED(data_len); + if (processing) + { + return 1; + } + + processing = true; + power_button_suspend(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); + power_button_suspend(false); + processing = false; return 1; } @@ -241,6 +251,8 @@ 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(); + power_button_suspend(false); + processing = false; return 1; } @@ -492,4 +504,4 @@ int cmd_mad(const uint8_t *data, uint8_t data_len) processing = false; return 1; -} \ No newline at end of file +} diff --git a/src/command/handlers/cmd_sensor.c b/src/command/handlers/cmd_sensor.c index cf49635..7f98820 100644 --- a/src/command/handlers/cmd_sensor.c +++ b/src/command/handlers/cmd_sensor.c @@ -39,6 +39,11 @@ int cmd_msp(const uint8_t *data, uint8_t data_len) ARG_UNUSED(data); ARG_UNUSED(data_len); + if (processing) + { + return 1; + } + int16_t accel[3], gyro[3]; int ret = imu_read(accel, gyro);