Browse Source

update

3lead_uart_test_ok_version
zhaohe 1 year ago
parent
commit
bfcd989a4e
  1. 18
      app/src/one_conduction/one_conduction_main.c

18
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

Loading…
Cancel
Save