주석 정리

This commit is contained in:
2026-06-26 17:21:41 +09:00
parent 0d719751c4
commit 39cf6068f7
2 changed files with 19 additions and 18 deletions
@@ -231,7 +231,7 @@ static char * roles_str[] = {"INVALID_ROLE", "CENTRAL", "PERIPHERAL"};
/*==============================================================================
* Global Variables
* IEC 62304 §5.5.3: all global buffers zero-initialized for deterministic startup
* IEC 62304 5.5.3: all global buffers zero-initialized for deterministic startup
*============================================================================*/
volatile uint8_t Sj_type; /* Command type identifier */
bool power_off_duble_prohibit = false; /* Power-off double prevention flag */
@@ -1546,7 +1546,7 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
DBG_PRINTF("[BLE] Connected\r\n");
#if BLE_DEV_MODE
/* Dev: no passkey/SEC allow NUS TX/RX as soon as GAP is up (prod uses PM_EVT_CONN_SEC_SUCCEEDED). */
/* Dev: no passkey/SEC - allow NUS TX/RX as soon as GAP is up (prod uses PM_EVT_CONN_SEC_SUCCEEDED). */
ble_connection_st = BLE_CONNECTED_ST;
battery_timer_start();
#endif
@@ -2077,6 +2077,7 @@ static void main_s(void * p_context)
bool button_released = nrf_gpio_pin_read(POWER_BUTTON);
/* ---- Running phase: post-boot button polling ---- */
if (booted)
{
@@ -2121,7 +2122,7 @@ static void main_s(void * p_context)
go_device_power_off = true;
main_timer_start();
}
else if (cnt_s > 250 || (m_reset_status == 2)) /* 250 x 5ms = 1.25s + α */
else if (cnt_s > 250 || (m_reset_status == 2)) /* 250 x 5ms = 1.25s + ¥á */
{
DBG_PRINTF("[BTN] Boot (cnt=%d)\r\n", cnt_s);
device_reset = false;
@@ -2150,7 +2151,7 @@ static void main_s(void * p_context)
cnt_s++;
device_reset = false;
if (cnt_s == 250) /* 250 x 5ms = 1.25s + α */
if (cnt_s == 250) /* 250 x 5ms = 1.25s + ¥á */
{
led_set_state(LED_STATE_POWER_ON);
DBG_PRINTF("[BTN] 2.0s\r\n");
@@ -2171,7 +2172,7 @@ int main(void)
{
bool erase_bonds_local = false;
/*──────────────────────────────────────────────────────────────
/*--------------------------------------------------------------------------
* Phase 1: Basic hardware init (BLE-independent)
*
* - Power self-latch (P0.8 HIGH)
@@ -2180,7 +2181,7 @@ int main(void)
* - App timers (power polling, battery, main loop)
* - Default config (serial number, passkey)
* - Buttons/LEDs
*────────────────────────────────────────────────────────────*/
*--------------------------------------------------------------------------*/
power_hold_init();
if ((NRF_POWER->GPREGRET2 & POST_DFU_APP_BOOT_GPREGRET2_MASK) != 0)
@@ -2203,7 +2204,7 @@ int main(void)
log_init();
DBG_PRINTF("\r\n========================================\r\n");
DBG_PRINTF(" Medithings v1.17\r\n");
DBG_PRINTF(" Medithings VesiScan-Basic\r\n");
DBG_PRINTF("========================================\r\n");
DBG_PRINTF("[1] HW Init\r\n");
@@ -2217,33 +2218,33 @@ int main(void)
#endif
DBG_PRINTF(" gpio/timer/config/btn OK\r\n");
/*──────────────────────────────────────────────────────────────
/*--------------------------------------------------------------------------
* Phase 2: BLE stack init
*
* - Power management module (WFE/sleep when idle)
* - SoftDevice S140 (BLE 5.0 protocol stack)
* - DC-DC converter enable (required after SoftDevice)
*────────────────────────────────────────────────────────────*/
*--------------------------------------------------------------------------*/
DBG_PRINTF("[2] BLE Stack\r\n");
power_management_init();
ble_stack_init();
APP_ERROR_CHECK(sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE));
DBG_PRINTF(" pwr/stack/dcdc OK\r\n");
/*──────────────────────────────────────────────────────────────
/*--------------------------------------------------------------------------
* Phase 3: Internal flash config (must init after BLE stack)
*
* - FDS (Flash Data Storage) init
* - Read stored config from flash (serial, passkey, piezo, etc.)
* - Overwrite defaults with flash values
*────────────────────────────────────────────────────────────*/
*--------------------------------------------------------------------------*/
DBG_PRINTF("[3] FDS\r\n");
fs_storage_init();
config_load();
load_flash_config();
DBG_PRINTF(" fds OK\r\n");
/*──────────────────────────────────────────────────────────────
/*--------------------------------------------------------------------------
* Phase 4: BLE protocol setup
*
* - GAP: device name (serial number), connection params, passkey
@@ -2252,7 +2253,7 @@ int main(void)
* - Advertising: advertising data (name, UUID)
* - Connection parameter negotiation module
* - Security: Peer Manager (bonding/passkey)
*────────────────────────────────────────────────────────────*/
*--------------------------------------------------------------------------*/
DBG_PRINTF("[4] BLE Protocol\r\n");
gap_params_init();
gatt_init();
@@ -2287,14 +2288,14 @@ int main(void)
DBG_PRINTF(" fds defaults saved\r\n");
}
/*──────────────────────────────────────────────────────────────
/*--------------------------------------------------------------------------
* Phase 5: Application init
*
* - Command parser: process BLE received commands (log, BLE TX, CRC)
* - Piezo driver: GPIO/Timer/PPI setup for ultrasound measurement
* - IMU (ICM42670P) is NOT initialized here
* -> imu_read_direct() self-configures/reads/sleeps on each msp? command
*────────────────────────────────────────────────────────────*/
*--------------------------------------------------------------------------*/
DBG_PRINTF("[5] App\r\n");
g_plat.log = log_printf;
g_plat.tx_bin = dr_binary_tx_safe;
@@ -2304,9 +2305,9 @@ int main(void)
dr_piezo_init();
DBG_PRINTF(" parser/piezo OK\r\n");
/*──────────────────────────────────────────────────────────────
/*--------------------------------------------------------------------------
* Boot complete -> start power button state machine
*────────────────────────────────────────────────────────────*/
*--------------------------------------------------------------------------*/
DBG_PRINTF("\r\n========================================\r\n");
DBG_PRINTF(" READY [%s]\r\n", SERIAL_NO);
DBG_PRINTF("========================================\r\n\r\n");
@@ -53,7 +53,7 @@
* : Unify both IMU direct-read and FIFO outputs as raw data in datasheet axis convention.
* - VBTFW0120 260615 jhChun : Add EMC mitigation logic for BLE link stability: extended supervision timeout and dynamic TX power control based on RSSI, RSSI silence, HVN latency, and TX queue congestion.
------------------------------------------------------------------------- */
#define FIRMWARE_VERSION "VBTFW0129"
#define FIRMWARE_VERSION "VBTFW0120"
/*==============================================================================
* Data Length Constants