Browse Source

update

master
zhaohe 1 year ago
parent
commit
60615875a5
  1. 37
      app/src/app_service/ecg_service/ecg_algo.c
  2. 2
      app/src/app_service/ecg_service/ecg_algo.h
  3. 4
      app/src/app_service/ecg_service/ecg_service.c
  4. 2
      app/src/aproject_config/config.h
  5. 4
      app/src/one_conduction_main.c

37
app/src/app_service/ecg_service/ecg_algo.c

@ -6,7 +6,7 @@
#include "algo/zsimple_qrs.h" #include "algo/zsimple_qrs.h"
#include "znordic.h" #include "znordic.h"
#define REPORT_MEDIAN_WINDOWS_SIZE 151 // ±ØÐëÊÇÆæÊý
#define REPORT_MEDIAN_WINDOWS_SIZE 101 // ±ØÐëÊÇÆæÊý
LPFilterExt_t m_lp_filter; LPFilterExt_t m_lp_filter;
HPFilterExt_t m_hp_filter; HPFilterExt_t m_hp_filter;
@ -30,6 +30,21 @@ static int32_t m_frame_cnt;
void ecg_algo_init() { ecg_algo_reset(); } void ecg_algo_init() { ecg_algo_reset(); }
void leadoff_data_process(int32_t indata) {
zdata_statistics_push(&m_leadoff_statistics, indata);
if (zdata_statistics_is_full(&m_leadoff_statistics)) {
int32_t max = zdata_statistics_get_max(&m_leadoff_statistics);
int32_t min = zdata_statistics_get_min(&m_leadoff_statistics);
if (max - min < 6000) {
m_leadoff = true;
} else {
m_leadoff = false;
}
} else {
m_leadoff = true;
}
}
void report_data_process(int32_t indata) { void report_data_process(int32_t indata) {
m_frame_cnt++; m_frame_cnt++;
float data = indata; float data = indata;
@ -47,27 +62,11 @@ void report_data_process(int32_t indata) {
data = delay_data - medianValue; data = delay_data - medianValue;
data = SmoothingFilter_Update(&m_report_smoothing_filter, data); data = SmoothingFilter_Update(&m_report_smoothing_filter, data);
reportdata = data; reportdata = data;
}
void leadoff_data_process(int32_t indata) {
zdata_statistics_push(&m_leadoff_statistics, indata);
if (zdata_statistics_is_full(&m_leadoff_statistics)) {
int32_t max = zdata_statistics_get_max(&m_leadoff_statistics);
int32_t min = zdata_statistics_get_min(&m_leadoff_statistics);
if (max - min > 45000) {
m_leadoff = true;
} else {
m_leadoff = false;
}
} else {
m_leadoff = true;
}
leadoff_data_process(data);
} }
void ecg_algo_process_data(int32_t indata) {
leadoff_data_process(indata);
report_data_process(indata);
}
void ecg_algo_process_data(int32_t indata) { report_data_process(indata); }
void ecg_algo_reset() { void ecg_algo_reset() {
LPFilterExt_init(&m_lp_filter, 40, SAMPLE_PERIOD_S, 5, true); LPFilterExt_init(&m_lp_filter, 40, SAMPLE_PERIOD_S, 5, true);

2
app/src/app_service/ecg_service/ecg_algo.h

@ -5,7 +5,7 @@
#include "app_basic_service/zapp.h" #include "app_basic_service/zapp.h"
#define SAMPLE_PERIOD_S ((float)(1.0 / SAMPLE_RATE)) #define SAMPLE_PERIOD_S ((float)(1.0 / SAMPLE_RATE))
#define STATISTICS_BUF_SIZE ((int32_t)(0.5 / SAMPLE_PERIOD_S)) /*1s的数据*/
#define STATISTICS_BUF_SIZE ((int32_t)(1 / SAMPLE_PERIOD_S)) /*1s的数据*/
void ecg_algo_init(); void ecg_algo_init();
void ecg_algo_process_data(int32_t indata); void ecg_algo_process_data(int32_t indata);

4
app/src/app_service/ecg_service/ecg_service.c

@ -334,6 +334,8 @@ void ecg_service_start_capture() { //
regcache.resp2 = 0x07; // 10 regcache.resp2 = 0x07; // 10
regcache.gpio = 0x0c; // 11 regcache.gpio = 0x0c; // 11
regcache.ch1set = ADS129X_SET_BITS(regcache.ch1set, ADS129X_GAINx, ADS129X_GAIN_12);
if (m_testmode_flag) { if (m_testmode_flag) {
regcache.cfg2 = ADS129X_SET_BITS(regcache.cfg2, ADS129X_INT_TEST, ADS129X_INT_TEST_ON); regcache.cfg2 = ADS129X_SET_BITS(regcache.cfg2, ADS129X_INT_TEST, ADS129X_INT_TEST_ON);
regcache.cfg2 = ADS129X_SET_BITS(regcache.cfg2, ADS129X_INT_FREQ, ADS129X_INT_FREQ_AC); regcache.cfg2 = ADS129X_SET_BITS(regcache.cfg2, ADS129X_INT_FREQ, ADS129X_INT_FREQ_AC);
@ -371,5 +373,5 @@ void ecg_service_set_report_data_in_raw_mode(bool rawmode) { m_report_data_in_ra
bool ecg_leadoff_detect() { bool ecg_leadoff_detect() {
// return false; // return false;
return ecg_algo_get_leadoff_state();
return ecg_algo_get_leadoff_state();
} }

2
app/src/aproject_config/config.h

@ -7,7 +7,7 @@
#define CATEGORY "M1003" // 데돔젬 #define CATEGORY "M1003" // 데돔젬
#define MANUFACTURER_NAME "iflytop" #define MANUFACTURER_NAME "iflytop"
#define FIRMWARE_VERSION (509)
#define FIRMWARE_VERSION (513)
#define BLESTACK_VERSION 1 #define BLESTACK_VERSION 1
#define BOOTLOADER_VERSION 1 #define BOOTLOADER_VERSION 1
#define HARDWARE_VERSION (2) #define HARDWARE_VERSION (2)

4
app/src/one_conduction_main.c

@ -340,6 +340,9 @@ void on_zapp_ebus_event(void* p_event_data, uint16_t event_size) {
beep_set_effect(START_SAMPLE_EFFECT); beep_set_effect(START_SAMPLE_EFFECT);
} else if (event == kappevent_state_machine_state_exit) { } else if (event == kappevent_state_machine_state_exit) {
} else { } else {
zapp_state_machine_change_state(kstate_capture);
#if 0
if (zble_module_has_disconnected_ms() >= 5000) { if (zble_module_has_disconnected_ms() >= 5000) {
ecg_service_stop_capture(); ecg_service_stop_capture();
zapp_state_machine_change_state(kstate_standby); zapp_state_machine_change_state(kstate_standby);
@ -365,6 +368,7 @@ void on_zapp_ebus_event(void* p_event_data, uint16_t event_size) {
} }
} }
} }
#endif
} }
} else if (zapp_state_machine_now_state() == kstate_capture) { } else if (zapp_state_machine_now_state() == kstate_capture) {

Loading…
Cancel
Save