mtb? 정렬모드 중 IMU 주기 온도 읽기 비활성화

- 정렬모드(mtb?)일 때 FIFO가 활성화 상태, FW 내부 60초 주기 온도 점검을 위해 온도 레지스터 접근 시 오류 발생 가능
This commit is contained in:
2026-06-16 10:40:44 +09:00
parent 228f6da4a3
commit cda370b69d
3 changed files with 23 additions and 2 deletions
@@ -183,6 +183,11 @@ void battery_event_handler(nrf_drv_saadc_evt_t const * p_event)
low_battery_check = false; low_battery_check = false;
safety_batt_mv = batt_lvl_in_milli_volt_1; safety_batt_mv = batt_lvl_in_milli_volt_1;
if (imu_fifo_capture_is_active())
{
return;
}
if (imu_read_temperature_x100(NULL, &imu_temp_c) != 0) if (imu_read_temperature_x100(NULL, &imu_temp_c) != 0)
{ {
DBG_PRINTF("[SAFETY] IMU temp read failed\r\n"); DBG_PRINTF("[SAFETY] IMU temp read failed\r\n");
@@ -407,6 +407,7 @@ extern const nrfx_twi_t m_twi_icm42670;
#define IMU_TEMP_AVG_SAMPLES 4U #define IMU_TEMP_AVG_SAMPLES 4U
static bool s_direct_twi_ready = false; static bool s_direct_twi_ready = false;
static bool s_fifo_capture_active = false;
static void imu_direct_twi_init_once(void) static void imu_direct_twi_init_once(void)
{ {
@@ -569,6 +570,11 @@ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c)
return -1; return -1;
} }
if (s_fifo_capture_active)
{
return -4;
}
imu_direct_twi_init_once(); imu_direct_twi_init_once();
/* Power ON briefly so the temperature register is refreshed before reading. */ /* Power ON briefly so the temperature register is refreshed before reading. */
@@ -619,6 +625,11 @@ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c)
return 0; return 0;
} }
bool imu_fifo_capture_is_active(void)
{
return s_fifo_capture_active;
}
/* -------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------
* mtb? FIFO capture support * mtb? FIFO capture support
* *
@@ -642,8 +653,6 @@ int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c)
#define RIM_MAX_SAMPLE_BYTES (BLE_NUS_MAX_DATA_LEN - 2 - RIM_PACKET_HEADER_BYTES) #define RIM_MAX_SAMPLE_BYTES (BLE_NUS_MAX_DATA_LEN - 2 - RIM_PACKET_HEADER_BYTES)
#define RIM_SAMPLES_PER_PACKET (RIM_MAX_SAMPLE_BYTES / RIM_SAMPLE_SIZE_BYTES) #define RIM_SAMPLES_PER_PACKET (RIM_MAX_SAMPLE_BYTES / RIM_SAMPLE_SIZE_BYTES)
static bool s_fifo_capture_active = false;
static void imu_serif_make(struct inv_imu_serif *serif) static void imu_serif_make(struct inv_imu_serif *serif)
{ {
serif->context = 0; serif->context = 0;
@@ -963,9 +972,11 @@ int imu_fifo_capture_stop_and_send_rim(void)
{ {
DBG_PRINTF("[IMU FIFO] drain fail %d\r\n", rc); DBG_PRINTF("[IMU FIFO] drain fail %d\r\n", rc);
imu_fifo_send_rim_packets(0); imu_fifo_send_rim_packets(0);
imu_fifo_power_off();
return rc; return rc;
} }
imu_fifo_send_rim_packets(packet_count); imu_fifo_send_rim_packets(packet_count);
imu_fifo_power_off();
return 0; return 0;
} }
@@ -105,6 +105,11 @@ int imu_read_direct(void);
*/ */
int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c); int imu_read_temperature_x100(uint16_t *temp_x100, float *temp_c);
/**
* \brief Return true while IMU FIFO capture is active.
*/
bool imu_fifo_capture_is_active(void);
/** /**
* \brief Start IMU internal FIFO capture for mtb? test flow. * \brief Start IMU internal FIFO capture for mtb? test flow.
* Configures accel/gyro 100 Hz and flushes FIFO before capture. * Configures accel/gyro 100 Hz and flushes FIFO before capture.