From abb8d6078adbce9e8fa73bd04f3035b9cd0d2158 Mon Sep 17 00:00:00 2001 From: jhchun Date: Tue, 21 Jul 2026 15:51:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A0=84=EC=9B=90=20=EB=B2=84=ED=8A=BC=20ON/OF?= =?UTF-8?q?F=20=EC=9E=84=EA=B3=84=20=EC=B9=B4=EC=9A=B4=ED=8A=B8=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 버튼 감지 타이밍이 초기화 등으로 런타임과 달라서 체감상 3초로 맞추기 위해 분리 --- src/power/power_control.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/power/power_control.c b/src/power/power_control.c index 13e5889..00bd10e 100644 --- a/src/power/power_control.c +++ b/src/power/power_control.c @@ -17,11 +17,12 @@ #include "ble_service.h" #include "battery_adc.h" -#define POWER_HOLD_NODE DT_NODELABEL(pwr_hold) // 전원 래치 -#define POWER_BTN_NODE DT_NODELABEL(button_check) // 전원 버튼 -#define POWER_LOOP_INTERVAL 20 // 전원 시퀀스 타이머 간격(ms) -#define BOOT_THRESHOLD 350 // power button hold threshold -#define BOND_RESET_THRESHOLD (15000 / POWER_ON_DELAY) // 15s long press bond reset +#define POWER_HOLD_NODE DT_NODELABEL(pwr_hold) // 전원 래치 +#define POWER_BTN_NODE DT_NODELABEL(button_check) // 전원 버튼 +#define POWER_LOOP_INTERVAL 20 // 전원 시퀀스 타이머 간격(ms) +#define POWER_ON_THRESHOLD 350 // power button hold threshold(off -> on) +#define POWER_OFF_THRESHOLD 500 // power button hold threshold(on -> off) +#define BOND_RESET_THRESHOLD (15000 / POWER_ON_DELAY) // 15s long press bond reset static const struct gpio_dt_spec power_hold = GPIO_DT_SPEC_GET(POWER_HOLD_NODE, gpios); // 전원 유지 출력 static const struct gpio_dt_spec power_btn = GPIO_DT_SPEC_GET(POWER_BTN_NODE, gpios); // 전원 버튼 입력 @@ -211,7 +212,7 @@ static void main_s(struct k_timer *timer) { cnt_s++; - if (cnt_s == BOOT_THRESHOLD) // 임계 시간 도달 시 전원 ON 확정 + if (cnt_s == POWER_ON_THRESHOLD) // 임계 시간 도달 시 전원 ON 확정 { device_on = true; power_control_handler(ON, "button-2s-latch"); @@ -248,7 +249,7 @@ static void main_s(struct k_timer *timer) { cnt_s++; - if (cnt_s >= BOOT_THRESHOLD) + if (cnt_s >= POWER_OFF_THRESHOLD) { battery_timer_stop(); k_work_submit(&adv_stop_work);