diff --git a/app/main.hardtest.c b/app/main.hardtest.c index 20c1296..f3e3cfc 100644 --- a/app/main.hardtest.c +++ b/app/main.hardtest.c @@ -95,7 +95,7 @@ void main() { #endif /******************************************************************************* - * 屏幕测试+LED测试 * + * Ļ+LED * *******************************************************************************/ #if 0 const unsigned char gImage_0[1024] = { /* 0X22,0X01,0X80,0X00,0X40,0X00, */ @@ -291,13 +291,13 @@ void main() { } #endif /******************************************************************************* - * 蓝牙测试 * + * * *******************************************************************************/ #if 0 extern uint32_t g_nrf_log_tx_pin; APP_TIMER_DEF(m_test_tx_timer); -ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先?*/, 1 /*client num*/); +ZDATACHANNEL_DEF(m_zhrs, 2 /*ص¼??*/, 1 /*client num*/); static const char* hex2str(const uint8_t* data, int32_t len) { static char rx[64] = {0}; memset(rx, 0, sizeof(rx)); @@ -309,7 +309,7 @@ static const char* hex2str(const uint8_t* data, int32_t len) { static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { /** - * @brief 接收到指令数? + * @brief յָ?? */ if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) { ZLOGI("rx:%s", hex2str(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length)); @@ -317,7 +317,7 @@ static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { } static void on_service_init(void) { /** - * @brief 数据通道初始? + * @brief ͨʼ?? */ ZLOGI("init zdatachannel service"); zdatachannel_init_t zdatachannle_init; @@ -395,7 +395,7 @@ void main() { #endif #if 0 /******************************************************************************* - * 3导联-ADS1293-测试 * + * 3-ADS1293- * *******************************************************************************/ extern uint32_t g_nrf_log_tx_pin; @@ -459,7 +459,7 @@ static void test_tx_timer_cb(void* p_context) { // zdatachannel_data_send(tx, &p_length); } -ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先?*/, 1 /*client num*/); +ZDATACHANNEL_DEF(m_zhrs, 2 /*ص¼??*/, 1 /*client num*/); static const char* hex2str(const uint8_t* data, int32_t len) { static char rx[64] = {0}; memset(rx, 0, sizeof(rx)); @@ -473,7 +473,7 @@ static const char* hex2str(const uint8_t* data, int32_t len) { char cmdcache[256] = {0}; static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { /** - * @brief 接收到指令数? + * @brief յָ?? */ if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) { @@ -481,7 +481,7 @@ static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { } static void on_service_init(void) { /** - * @brief 数据通道初始? + * @brief ͨʼ?? */ ZLOGI("init zdatachannel service"); zdatachannel_init_t zdatachannle_init; @@ -520,7 +520,7 @@ void main() { #endif #if 0 /******************************************************************************* - * 3导联-led测试 * + * 3-led * *******************************************************************************/ static void test_tx_timer_cb(void* p_context) { static uint32_t data; @@ -549,7 +549,7 @@ void main() { #endif #if 0 /******************************************************************************* - * 3导联-电池电量测试 * + * 3-ص * *******************************************************************************/ static void test_tx_timer_cb(void* p_context) { static uint32_t data; @@ -579,7 +579,7 @@ void main() { #if 0 /******************************************************************************* - * 3导联-flash测试 * + * 3-flash * *******************************************************************************/ static void test_tx_timer_cb(void* p_context) { static uint32_t data; @@ -611,7 +611,7 @@ void main() { #if 0 /******************************************************************************* - * 3导联-flash测试 * + * 3-flash * *******************************************************************************/ static void test_tx_timer_cb(void* p_context) { static uint32_t data; diff --git a/app/src/one_conduction/heart_wave_sample_service.c b/app/src/one_conduction/heart_wave_sample_service.c index a779fed..54f1630 100644 --- a/app/src/one_conduction/heart_wave_sample_service.c +++ b/app/src/one_conduction/heart_wave_sample_service.c @@ -36,6 +36,7 @@ void nrfx_timer_event_handler(nrf_timer_event_t event_type, void* p_context) { uint16_t val = SingleLeadECG_battery_get_adc_val(); // 12bit m_real_time_data = (float)val / 4096.0f * 100; + ZLOGI("%d", val); if (m_capture_buffer == NULL) { swap_buffer(); diff --git a/app/src/one_conduction/one_conduction_main.c b/app/src/one_conduction/one_conduction_main.c index 97d0e57..29d2408 100644 --- a/app/src/one_conduction/one_conduction_main.c +++ b/app/src/one_conduction/one_conduction_main.c @@ -173,6 +173,7 @@ static void power_on() { hwss_init(); sample_data_mgr_init(); dsp_mgr_init(); + zble_module_start_adv(); m_poweronflag = true; ZERROR_CHECK(app_timer_start(m_state_machine_driver_tmr, APP_TIMER_TICKS(100), NULL)); // 200HZ @@ -187,6 +188,7 @@ static void power_off() { SingleLeadECG_led_deinit(); SingleLeadECG_beep_deinit(); SingleLeadECG_adc_module_deinit(); + zble_module_stop_adv(); ZERROR_CHECK(app_timer_stop(m_state_machine_driver_tmr)); } /******************************************************************************* @@ -347,18 +349,21 @@ void app_event_process_cb(void* p_event_data, uint16_t event_size) { * ---> л洢 */ + bool always_capture = true; if (p_event->eventType == kevent_capture_data_event) { if (hwss_has_captured_time_ms() <= (MAX_STORAGE_TIMEOUT_S * 1000)) { - ZLOGI("storage data 256 [%d]ms", hwss_has_captured_time_ms()); + // ZLOGI("storage data 256 [%d]ms", hwss_has_captured_time_ms()); sample_data_mgr_write(m_cur_fd, p_event->val.capture_data_cache, 256); } else { // 洢 /******************************************************************************* * лɼҳ * *******************************************************************************/ - sample_data_mgr_close(m_cur_fd); - state_machine_change_to_state(kdevice_state_sampling_complete); - hwss_stop_capture(); + if (!always_capture) { + sample_data_mgr_close(m_cur_fd); + state_machine_change_to_state(kdevice_state_sampling_complete); + hwss_stop_capture(); + } } } else if (!m_plod_state_connected_state || p_event->eventType == kplod_disconnected_event) { if (hwss_has_captured_time_ms() < 30000) { @@ -366,20 +371,24 @@ void app_event_process_cb(void* p_event_data, uint16_t event_size) { /******************************************************************************* * лɼҳ * *******************************************************************************/ - sample_data_mgr_close(m_cur_fd); - sample_data_mgr_delete_file(&sampledata_file_name); - dsp_mgr_change_to_samplingError(); - state_machine_change_to_state(kdevice_state_sampling_error); - hwss_stop_capture(); + if (!always_capture) { + sample_data_mgr_close(m_cur_fd); + sample_data_mgr_delete_file(&sampledata_file_name); + dsp_mgr_change_to_samplingError(); + state_machine_change_to_state(kdevice_state_sampling_error); + hwss_stop_capture(); + } } else { // ɼ30 /******************************************************************************* * лɼҳ * *******************************************************************************/ - sample_data_mgr_close(m_cur_fd); - dsp_mgr_change_to_sampleSuc(); - state_machine_change_to_state(kdevice_state_sampling_complete); - hwss_stop_capture(); + if (!always_capture) { + sample_data_mgr_close(m_cur_fd); + dsp_mgr_change_to_sampleSuc(); + state_machine_change_to_state(kdevice_state_sampling_complete); + hwss_stop_capture(); + } } } } else if (m_device_state == kdevice_state_sampling_complete) {