DEBUG_MINIMAL_BOOT 삭제

- main.c: DEBUG_MINIMAL_BOOT 삭제 및 분기문 정리
- main.c: minimal_gpio_init() + full_gpio_init() → gpio_init() 하나로 통합
- main.c: icm42670_init() 분기 제거, advertising_start()만 남김
- power_control.c: SW I2C/센서 전원 시퀀스 제거, p_order = 2로 즉시 완료
This commit is contained in:
jhChun
2026-03-26 11:12:26 +09:00
parent e461f59a5f
commit 9580bffa65
2 changed files with 11 additions and 89 deletions

View File

@@ -19,7 +19,7 @@
* [소프트웨어 부트 시퀀스 — main() 함수]
* Phase 0: 전원 유지 (power_hold_init → P0.8 HIGH)
* Phase 1: UART 초기화 (1Mbps), 로그 초기화
* Phase 2: GPIO 초기화 (DEBUG_MINIMAL_BOOT에 따라 분기)
* Phase 2: GPIO 초기화
* Phase 3: 타이머 초기화 (app_timer, 배터리, 전원 시퀀스)
* Phase 4: 설정 로드 (기본값 → FDS에서 덮어쓰기)
* Phase 5: 버튼/LED BSP 초기화
@@ -42,8 +42,6 @@
* 5. dr_binary_tx_safe()로 CRC16 추가 후 BLE 전송 (최대 100회 재시도)
*
* [빌드 모드]
* DEBUG_MINIMAL_BOOT = 1 : 전원+BLE만 (센서/EEPROM 초기화 생략, 개발용)
* DEBUG_MINIMAL_BOOT = 0 : 전체 초기화 (양산용)
* BLE_DEV_MODE = 1 : 보안 없음 (빠른 페어링, 개발용)
* BLE_DEV_MODE = 0 : 정적 패스키 + MITM 보호 (양산용)
******************************************************************************/
@@ -130,9 +128,9 @@
/*==============================================================================
* 빌드 설정
* DEBUG_MINIMAL_BOOT 삭제 26.03.26 jhChun
*============================================================================*/
#define BLE_DEV_MODE 1 /* 1: 개발 모드 (보안 없음), 0: 양산 모드 (패스키 필수) */
#define DEBUG_MINIMAL_BOOT 1 /* 1: 최소 부팅 (전원+BLE만), 0: 전체 부팅 (센서 포함) */
/*==============================================================================
* 하드웨어 핀 정의
@@ -340,38 +338,20 @@ static void power_control_handler(on_off_cont_t device_power_st)
*============================================================================*/
/**
* @brief 최소 GPIO 초기화 (DEBUG_MINIMAL_BOOT 모드용)
* @brief GPIO 초기화
*
* 전원 버튼 입력과 전원 유지 핀만 설정
* 센서 관련 GPIO는 초기화하지 않음
*/
static void minimal_gpio_init(void)
static void gpio_init(void)
{
nrf_gpio_cfg_input(POWER_BUTTON, NRF_GPIO_PIN_NOPULL);
nrf_gpio_cfg_output(POWER_HOLD);
nrf_gpio_pin_set(POWER_HOLD);
power_gpio_init();
DBG_PRINTF("[GPIO] Minimal OK (BTN=%d)\r\n", nrf_gpio_pin_read(POWER_BUTTON));
DBG_PRINTF("[GPIO] OK (BTN=%d)\r\n", nrf_gpio_pin_read(POWER_BUTTON));
}
#if !DEBUG_MINIMAL_BOOT
/**
* @brief 전체 GPIO 초기화 (양산 모드, DEBUG_MINIMAL_BOOT=0)
*
* minimal_gpio_init()를 먼저 호출한 뒤, EEPROM 전원을 OFF하여
* 불필요한 전력 소모를 방지한다.
*/
static void full_gpio_init(void)
{
minimal_gpio_init();
eeprom_control(OFF);
DBG_PRINTF("[GPIO] Full OK\r\n");
}
#endif
/*==============================================================================
* 설정 로드
* FDS(Flash Data Storage)에서 설정을 읽기 전에 기본값을 먼저 로드
@@ -1085,9 +1065,6 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
APP_ERROR_CHECK(err_code);
#if DEBUG_MINIMAL_BOOT
DBG_PRINTF("[BLE] Minimal mode\r\n");
#endif
break;
case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
@@ -1647,30 +1624,12 @@ static void main_s(void * p_context)
power_control_handler(ON);
battery_timer_start();
#if DEBUG_MINIMAL_BOOT
DBG_PRINTF("[BOOT] Minimal\r\n");
#if FEATURE_SECURE_CONNECTION
advertising_start(erase_bonds);
#else
advertising_start();
#endif
DBG_PRINTF("[BOOT] ADV started\r\n");
#else
DBG_PRINTF("[BOOT] Full\r\n");
icm42670_init();
nrf_delay_ms(2);
#if FEATURE_SECURE_CONNECTION
advertising_start(erase_bonds);
#else
advertising_start();
#endif
m_reset_status = 1;
m_config.reset_status = m_reset_status;
config_save();
#endif
m_reset_status = 1;
DBG_PRINTF("[BOOT] Ready\r\n");
}
@@ -1711,17 +1670,13 @@ int main(void)
log_init();
DBG_PRINTF("\r\n========================================\r\n");
DBG_PRINTF(" Medithings v1.17 [%s]\r\n", DEBUG_MINIMAL_BOOT ? "MIN" : "FULL");
DBG_PRINTF(" Medithings v1.17\r\n");
DBG_PRINTF("========================================\r\n");
DBG_PRINTF("[0] PWR_HOLD\r\n");
// PHASE 2: GPIO
DBG_PRINTF("[1] GPIO\r\n");
#if DEBUG_MINIMAL_BOOT
minimal_gpio_init();
#else
full_gpio_init();
#endif
gpio_init();
info4 = false;