diff --git a/README.md b/README.md index 38d886e..e4897c9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ ``` +V12: + 1. 修复上传后,不关闭文件描述符的BUG + 2. 添加导联线未插入状态下,开始检测指令回复错误码的功能。 + + + # TODO: 修改蓝牙测试Server程序,测试程序蓝牙名称过滤标志为 iflytop_ble_test_device OK 修改蓝牙名称生成规则,规则为,当device_id为0或者全F,蓝牙名称为iflytop_ble_test_device,否则蓝牙名称为产品SN码 OK diff --git a/app/src/app_ble_service.c b/app/src/app_ble_service.c index 60013c0..093bc77 100644 --- a/app/src/app_ble_service.c +++ b/app/src/app_ble_service.c @@ -260,6 +260,12 @@ int RecordUpload_stop_upload() { m_isupload_data_state = false; SampleDataMgr_changeToExtMode(); app_timer_stop(m_record_upload_tmr); + + if (m_upload_fd > 0) { + SampleDataMgr_close(m_upload_fd); + m_upload_fd = 0; + } + return 0; } bool RecordUpload_is_uploading() { return m_isupload_data_state; } @@ -364,6 +370,12 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) { if (RecordUpload_is_uploading()) { ZLOGI("uploading,can not start capture"); send_error_receipt(rxheader, kifyhrs_ecode_device_busy); + return; + } + + if (!hwss_line_detect_get_state()) { + send_error_receipt(rxheader, kifyhrs_ecode_electrode_is_not_inserted); + return; } DeviceCtrl_startSample(0); @@ -384,6 +396,12 @@ static void prvf_process_ble_rx_data(void* p_event_data, uint16_t len) { if (RecordUpload_is_uploading()) { ZLOGI("uploading,can not start capture"); send_error_receipt(rxheader, kifyhrs_ecode_device_busy); + return; + } + + if (!hwss_line_detect_get_state()) { + send_error_receipt(rxheader, kifyhrs_ecode_electrode_is_not_inserted); + return; } DeviceCtrl_startSample(capture_time_s); diff --git a/app/src/basic/version.h b/app/src/basic/version.h index afeda6d..c688909 100644 --- a/app/src/basic/version.h +++ b/app/src/basic/version.h @@ -2,7 +2,7 @@ #define CATEGORY "M1002" // 三导联 #define MANUFACTURER_NAME "iflytop" -#define FIRMWARE_VERSION (11) +#define FIRMWARE_VERSION (12) #define BLESTACK_VERSION 1 #define BOOTLOADER_VERSION 1 #define HARDWARE_VERSION (1) diff --git a/app/src/device_ctrl_service.c b/app/src/device_ctrl_service.c index 07045d9..c8c0014 100644 --- a/app/src/device_ctrl_service.c +++ b/app/src/device_ctrl_service.c @@ -158,6 +158,9 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { // // } // ZLOGI("button %d", nrf_gpio_pin_read(BUTTON_PIN)); + // hwss_line_detect_get_state + // ZLOGI("%d",hwss_line_detect_get_state()); + /******************************************************************************* * 状态无关事件处理 * *******************************************************************************/ diff --git a/app/src/heart_wave_sample_service.c b/app/src/heart_wave_sample_service.c index 2e46753..bbe0fee 100644 --- a/app/src/heart_wave_sample_service.c +++ b/app/src/heart_wave_sample_service.c @@ -511,6 +511,8 @@ void hwss_init(void) { inConfig.sense = NRF_GPIOTE_POLARITY_HITOLO; // 下降沿触发 ZERROR_CHECK(nrfx_gpiote_in_init(ADS1293_READY_PIN, &inConfig, ads1293_ready_pin_irq)); } + + nrf_gpio_cfg_input(LINE_DET_PIN, NRF_GPIO_PIN_PULLUP); #else /** * @brief 初始化定时器 @@ -623,4 +625,9 @@ void hwss_stop_capture(void) { bool hwss_is_capturing(void) { return m_work_flag; } uint8_t hwss_get_drop_state0() { return m_lodstate0; } -uint8_t hwss_get_drop_state1() { return m_lodstate1; } \ No newline at end of file +uint8_t hwss_get_drop_state1() { return m_lodstate1; } + + +bool hwss_line_detect_get_state(){ + return !nrf_gpio_pin_read(LINE_DET_PIN); +} diff --git a/app/src/heart_wave_sample_service.h b/app/src/heart_wave_sample_service.h index a6d4d1b..9341e1f 100644 --- a/app/src/heart_wave_sample_service.h +++ b/app/src/heart_wave_sample_service.h @@ -35,3 +35,5 @@ uint32_t hwss_started_has_passed_s(void); uint8_t hwss_get_drop_state0(); uint8_t hwss_get_drop_state1(); + +bool hwss_line_detect_get_state(); diff --git a/ify_hrs_protocol b/ify_hrs_protocol index da8e077..f2eae40 160000 --- a/ify_hrs_protocol +++ b/ify_hrs_protocol @@ -1 +1 @@ -Subproject commit da8e07706a41c157a3e42da3f69136f665f5a20f +Subproject commit f2eae40f67048820f37dc5dd3585ca9a75156dfc