코드 정리

This commit is contained in:
2026-04-20 14:22:43 +09:00
parent 009897a7d8
commit 163593c0cd
4 changed files with 43 additions and 40 deletions

View File

@@ -143,13 +143,10 @@ static void fds_evt_handler( fds_evt_t const *p_evt )
break; break;
case FDS_EVT_WRITE: case FDS_EVT_WRITE:
{
fds_flag_write = false; fds_flag_write = false;
}
break; break;
case FDS_EVT_UPDATE: case FDS_EVT_UPDATE:
{
fds_flag_write = false; fds_flag_write = false;
if (go_device_power_off == true) if (go_device_power_off == true)
@@ -165,7 +162,6 @@ static void fds_evt_handler( fds_evt_t const *p_evt )
DBG_PRINTF("Off FDS_EVENT\r\n"); DBG_PRINTF("Off FDS_EVENT\r\n");
NVIC_SystemReset(); NVIC_SystemReset();
} }
}
break; break;
case FDS_EVT_DEL_RECORD: case FDS_EVT_DEL_RECORD:

View File

@@ -39,10 +39,12 @@ static void twi_uninitialize(void)
} }
/* Initialise the TWI peripheral (SCL/SDA pins, 400 kHz, blocking mode). */ /* Initialise the TWI peripheral (SCL/SDA pins, 400 kHz, blocking mode). */
static void twi_initialize(void){ static void twi_initialize(void)
{
ret_code_t err_code; ret_code_t err_code;
const nrfx_twi_config_t twi_config = { const nrfx_twi_config_t twi_config =
{
.scl = ICM42670_I2C_SCL_PIN, .scl = ICM42670_I2C_SCL_PIN,
.sda = ICM42670_I2C_SDA_PIN, .sda = ICM42670_I2C_SDA_PIN,
.frequency = NRF_TWI_FREQ_400K, .frequency = NRF_TWI_FREQ_400K,

View File

@@ -99,8 +99,8 @@ extern bool motion_data_once;
*============================================================================*/ *============================================================================*/
void safety_check_complete(float temp_c) void safety_check_complete(float temp_c)
{ {
DBG_PRINTF("[SAFETY] Batt=%d mV, Temp=%d.%d C\r\n", //DBG_PRINTF("[SAFETY] Batt=%d mV, Temp=%d.%d C\r\n",
(int)safety_batt_mv, (int)temp_c, ((int)(temp_c * 10)) % 10); // (int)safety_batt_mv, (int)temp_c, ((int)(temp_c * 10)) % 10);
/* Battery check */ /* Battery check */
if (safety_batt_mv <= LOW_BATTERY_VOLTAGE) if (safety_batt_mv <= LOW_BATTERY_VOLTAGE)

View File

@@ -74,7 +74,8 @@ int device_sleep_mode(void)
* *
* @return 0 (always succeeds) * @return 0 (always succeeds)
*/ */
int device_activated(void){ int device_activated(void)
{
int rc = 0; int rc = 0;
p_order = 0; /* State machine start step (Step 0: I2C init) */ p_order = 0; /* State machine start step (Step 0: I2C init) */
lock_check =true; /* Lock: power sequence in progress */ lock_check =true; /* Lock: power sequence in progress */
@@ -117,10 +118,13 @@ void power_loop(void *p_context)
/* Advance to next step or finish */ /* Advance to next step or finish */
/* Advance to next step or finish sequence */ /* Advance to next step or finish sequence */
if (p_order < 2) { if (p_order < 2)
{
p_order++; /* Move to next step */ p_order++; /* Move to next step */
power_timer_start(); /* Execute next step after 20ms */ power_timer_start(); /* Execute next step after 20ms */
} else { }
else
{
/* Power sequence fully complete */ /* Power sequence fully complete */
DBG_PRINTF("[PWR] Device Activated OK!\r\n"); DBG_PRINTF("[PWR] Device Activated OK!\r\n");
} }
@@ -135,7 +139,8 @@ void power_loop(void *p_context)
* *
* @return 0 (always succeeds) * @return 0 (always succeeds)
*/ */
int device_reactivated(void){ int device_reactivated(void)
{
int rc = 0; int rc = 0;
sw_i2c_init_once(); /* Re-initialize I2C bus */ sw_i2c_init_once(); /* Re-initialize I2C bus */
nrf_delay_ms(10); /* Stabilization delay */ nrf_delay_ms(10); /* Stabilization delay */