|
|
@ -123,6 +123,8 @@ static void power_on() { |
|
|
|
ble_cmder_init(); |
|
|
|
ble_cmder_start_adv(); |
|
|
|
|
|
|
|
// SingleLeadECG_beep_trigger_once(); |
|
|
|
|
|
|
|
m_poweronflag = true; |
|
|
|
ZERROR_CHECK(app_timer_start(m_state_machine_driver_tmr, APP_TIMER_TICKS(100), NULL)); // 200HZ采样 |
|
|
|
} |
|
|
@ -262,6 +264,7 @@ void app_event_process_cb(void* p_event_data, uint16_t event_size) { |
|
|
|
static ztm_t tm; |
|
|
|
memset(&sampledata_file_name, 0, sizeof(sampledata_file_name)); |
|
|
|
znordic_rtc_gettime(&tm); |
|
|
|
sample_capture_state_reset(); |
|
|
|
|
|
|
|
sampledata_file_name.year = tm.tm_year + 1900 - 2000; |
|
|
|
sampledata_file_name.month = tm.tm_mon + 1; |
|
|
@ -324,6 +327,10 @@ void app_event_process_cb(void* p_event_data, uint16_t event_size) { |
|
|
|
// 单帧实时上报 |
|
|
|
ble_cmder_try_report_one_sample_data(p_event->val.frame_data.frameIndex, p_event->val.frame_data.data); |
|
|
|
} else if (p_event->eventType == kplod_disconnected_event || !m_plod_state_connected_state) { |
|
|
|
/******************************************************************************* |
|
|
|
* 导联断开 * |
|
|
|
*******************************************************************************/ |
|
|
|
|
|
|
|
if (hwss_has_captured_time_ms() < (SAMPLE_MIN_TIME_S * 1000)) { |
|
|
|
// 采集不足30秒 |
|
|
|
ble_cmder_try_report_sensor_drop_event(0x01, 0); |
|
|
@ -337,28 +344,37 @@ void app_event_process_cb(void* p_event_data, uint16_t event_size) { |
|
|
|
ds_change_to_state(kdevice_state_sampling_error); |
|
|
|
hwss_stop_capture(); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
// 采集超过30秒 |
|
|
|
/******************************************************************************* |
|
|
|
* 切换到采集完成页面 * |
|
|
|
*******************************************************************************/ |
|
|
|
if (!always_capture) { |
|
|
|
SingleLeadECG_beep_trigger_once(); |
|
|
|
sample_data_mgr_close(m_cur_fd); |
|
|
|
dsp_mgr_change_to_sampleSuc(); |
|
|
|
ds_change_to_state(kdevice_state_sampling_complete); |
|
|
|
hwss_stop_capture(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (hwss_has_captured_time_ms() >= (SAMPLE_MIN_TIME_S * 1000)) { |
|
|
|
if (!sample_capture_state_get()->is_over30s) { |
|
|
|
SingleLeadECG_beep_trigger_once(); |
|
|
|
sample_capture_state_set_is_over30s(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (ds_now_state() == kdevice_state_sampling_complete) { |
|
|
|
if (ds_cur_state_haspassed_ms() >= 2000) { |
|
|
|
ZLOGI("ds_cur_state_haspassed_ms() %d> 2000", ds_cur_state_haspassed_ms()); |
|
|
|
if (ds_cur_state_haspassed_ms() >= 3000) { |
|
|
|
ZLOGI("ds_cur_state_haspassed_ms() %d> 3000", ds_cur_state_haspassed_ms()); |
|
|
|
state_machine__change_to_home_state(); |
|
|
|
ble_cmder_report_sample_finish_event(); |
|
|
|
} |
|
|
|
} else if (ds_now_state() == kdevice_state_sampling_error) { |
|
|
|
if ((ds_cur_state_haspassed_ms() >= 2000) || (ds_cur_state_haspassed_ms() >= 1000 && m_plod_state_connected_state)) { |
|
|
|
ZLOGI("ds_cur_state_haspassed_ms() %d> 2000", ds_cur_state_haspassed_ms()); |
|
|
|
if ((ds_cur_state_haspassed_ms() >= 3000) || (ds_cur_state_haspassed_ms() >= 1000 && m_plod_state_connected_state)) { |
|
|
|
ZLOGI("ds_cur_state_haspassed_ms() %d> 3000", ds_cur_state_haspassed_ms()); |
|
|
|
state_machine__change_to_home_state(); |
|
|
|
ble_cmder_report_sample_finish_event(); |
|
|
|
} |
|
|
@ -400,7 +416,7 @@ void one_conduction_main() { |
|
|
|
znordic_rtc_gettime(&tm); |
|
|
|
NRF_LOG_INFO("RTC time :%d-%d-%d %d:%d:%d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); |
|
|
|
static char ble_name[20]; |
|
|
|
sn_t sn; |
|
|
|
sn_t sn; |
|
|
|
device_info_read_sn(&sn); |
|
|
|
memcpy(ble_name, sn.sn, sizeof(sn.sn)); |
|
|
|
|
|
|
|