From 466d3469d6dd278b72ac605327ba2db98a9afdab Mon Sep 17 00:00:00 2001 From: zhaohe Date: Fri, 9 Feb 2024 19:41:58 +0800 Subject: [PATCH] update --- app/src/board/board.h | 2 +- app/src/one_conduction_main.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/board/board.h b/app/src/board/board.h index cfe8963..d066c9c 100644 --- a/app/src/board/board.h +++ b/app/src/board/board.h @@ -28,7 +28,7 @@ #define MAX_FILE_NUM 10 // 最多存储条目数 #define SAMPLE_RATE 500 // 采样率 #define SAMPLE_PRECISION 12 // 采样精度 -#define AUTOMATIC_SLEEP_TIME 30000 // 开机后自动休眠时间 +#define AUTOMATIC_SLEEP_TIME 5000 // 开机后自动休眠时间 #define SAMPLE_MIN_TIME_S (30.0) // 采样最小时间 #define LITTLE_DATA_BLOCK_FRAME_NUM 5 // 每次多少帧上报一次 diff --git a/app/src/one_conduction_main.c b/app/src/one_conduction_main.c index f5d0ef8..4baa0da 100644 --- a/app/src/one_conduction_main.c +++ b/app/src/one_conduction_main.c @@ -59,11 +59,11 @@ static void power_on() { return; } - hwss_init(); BoardBeepCtrl_load(); BoardEcgSensor_load(); BoardBattery_load(); SingleLeadECG_led_init(); + hwss_init(); sample_data_mgr_init(); dsp_mgr_init(); @@ -72,6 +72,7 @@ static void power_on() { m_poweronflag = true; } static void power_off() { + if (!m_poweronflag) return; dsp_mgr_uninit(); sample_data_mgr_uninit(); hwss_uninit(); @@ -137,7 +138,7 @@ void ENTER_DEEP_SLEEP() { BoardBattery_sence_gpio_init_before_sleep(); // nrf_sdh_disable_request(); app_timer_stop_all(); - nrf_sdh_disable_request(); + // nrf_sdh_disable_request(); sd_power_system_off(); NVIC_SystemReset(); } @@ -168,9 +169,9 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { } // 10秒后,如果RTC未被设置过,则进入超低功耗 - else if (ds_cur_state_haspassed_ms() >= 10000) { + else if (ds_cur_state_haspassed_ms() >= 2000) { if (!znordic_rtc_has_setted()) { - // ENTER_DEEP_SLEEP(); + ENTER_DEEP_SLEEP(); } } } @@ -381,6 +382,6 @@ void one_conduction_main() { ZERROR_CHECK(app_timer_create(&m_state_machine_driver_tmr, APP_TIMER_MODE_REPEATED, state_machine_driver_tmr_cb)); ZERROR_CHECK(app_timer_start(m_state_machine_driver_tmr, APP_TIMER_TICKS(300), NULL)); - state_machine__change_to_standby_state(); + state_machine__change_to_poweroning_state(); znordic_loop(); }