Browse Source

update

3lead_uart_test_ok_version
zhaohe 1 year ago
parent
commit
3aaeafd2fa
  1. 26
      app/main.hardtest.c
  2. 1
      app/src/one_conduction/heart_wave_sample_service.c
  3. 35
      app/src/one_conduction/one_conduction_main.c

26
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;

1
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();

35
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) {

Loading…
Cancel
Save