From bfcd989a4e4d32828eeab78c9ef25379132a0cc1 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Mon, 29 Jan 2024 11:45:37 +0800 Subject: [PATCH] update --- app/src/one_conduction/one_conduction_main.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/one_conduction/one_conduction_main.c b/app/src/one_conduction/one_conduction_main.c index 14715e0..97d0e57 100644 --- a/app/src/one_conduction/one_conduction_main.c +++ b/app/src/one_conduction/one_conduction_main.c @@ -82,12 +82,15 @@ static sample_data_filename_t sampledata_file_name; *******************************************************************************/ // 导联连接状态事件生成器 -static uint32_t m_plod_state_disconnect_timepoint = 0; -static uint32_t m_plod_state_connect_timepoint = 0; -static bool m_plod_state_connected_state = false; -static uint32_t plod_state_has_disconnected_ms() { return znordic_haspassed_ms(m_plod_state_disconnect_timepoint); } +static uint32_t m_plod_state_disconnect_timepoint = 0; +static uint32_t m_plod_state_connect_timepoint = 0; +static bool m_plod_state_connected_state = false; +static uint32_t m_connecte_state_last_trigger_timepoint = 0; + +static uint32_t plod_state_has_disconnected_ms() { return znordic_haspassed_ms(m_connecte_state_last_trigger_timepoint); } static bool plod_state_is_connected() { return m_plod_state_connected_state; } -static void m_plod_state_event_detect_tmr_cb(void* p_context) { // + +static void m_plod_state_event_detect_tmr_cb(void* p_context) { // static uint32_t connecte_state_trigger_cnt = 0; static uint32_t connecte_state_trigger_cnt_last_val = 0; static app_event_t appevent; @@ -96,11 +99,12 @@ static void m_plod_state_event_detect_tmr_cb(void* p_context) { // connecte_state_trigger_cnt_last_val = connecte_state_trigger_cnt; if (SingleLeadECG_ecg_plod_get_connected_state()) { connecte_state_trigger_cnt++; + m_connecte_state_last_trigger_timepoint = znordic_getpower_on_ms(); } else { connecte_state_trigger_cnt = 0; } - if (connecte_state_trigger_cnt == 5) { + if (connecte_state_trigger_cnt == 15) { // 连接事件 appevent.eventType = kplod_connected_event; m_plod_state_connect_timepoint = znordic_getpower_on_ms(); @@ -460,7 +464,7 @@ void one_conduction_main() { ZERROR_CHECK(app_timer_create(&m_plod_state_event_detect_tmr, APP_TIMER_MODE_REPEATED, m_plod_state_event_detect_tmr_cb)); ZERROR_CHECK(app_timer_create(&m_charge_event_detect_tmr, APP_TIMER_MODE_REPEATED, m_charge_event_detect_tmr_cb)); - ZERROR_CHECK(app_timer_start(m_plod_state_event_detect_tmr, APP_TIMER_TICKS(100), NULL)); + ZERROR_CHECK(app_timer_start(m_plod_state_event_detect_tmr, APP_TIMER_TICKS(30), NULL)); ZERROR_CHECK(app_timer_start(m_charge_event_detect_tmr, APP_TIMER_TICKS(100), NULL)); #endif