|
@ -18,8 +18,8 @@ static uint8_t rxbufcache[256]; |
|
|
static bool is_rxbufcache_used = false; // 接收到的消息是否正在被处理中 |
|
|
static bool is_rxbufcache_used = false; // 接收到的消息是否正在被处理中 |
|
|
static bool m_realtime_report_state = false; // 实时上报状态 |
|
|
static bool m_realtime_report_state = false; // 实时上报状态 |
|
|
|
|
|
|
|
|
static uint8_t m_txbuf[128]; |
|
|
|
|
|
static uint8_t m_reportbuf[128]; |
|
|
|
|
|
|
|
|
static uint8_t m_txbuf[256]; |
|
|
|
|
|
static uint8_t m_reportbuf[256]; |
|
|
|
|
|
|
|
|
APP_TIMER_DEF(m_record_upload_tmr); // 数据上报定时器 |
|
|
APP_TIMER_DEF(m_record_upload_tmr); // 数据上报定时器 |
|
|
APP_TIMER_DEF(m_record_upload_finish_packet_report_tmr); // 数据上报完成上报定时器 |
|
|
APP_TIMER_DEF(m_record_upload_finish_packet_report_tmr); // 数据上报完成上报定时器 |
|
@ -111,7 +111,7 @@ static void prvf_try_report_sample_end_event() { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void prvf_report_sample_data(uint32_t frameIndex, uint32_t data, uint32_t data2, uint32_t data3) { |
|
|
|
|
|
|
|
|
void prvf_report_sample_data(uint32_t frameIndex, one_frame_data_t* data, int32_t ndata) { |
|
|
if (!m_realtime_report_state) { |
|
|
if (!m_realtime_report_state) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -125,19 +125,22 @@ void prvf_report_sample_data(uint32_t frameIndex, uint32_t data, uint32_t data2, |
|
|
/** |
|
|
/** |
|
|
* @brief 第一导联数据 |
|
|
* @brief 第一导联数据 |
|
|
*/ |
|
|
*/ |
|
|
// reportpacket->data[0] = (data >> 0) & 0xFF; |
|
|
|
|
|
// reportpacket->data[1] = (data >> 8) & 0xFF; |
|
|
|
|
|
// reportpacket->data[2] = (data >> 16) & 0xFF; |
|
|
|
|
|
// reportpacket->data[3] = |
|
|
|
|
|
|
|
|
for (int i = 0; i < ndata; i++) { |
|
|
|
|
|
|
|
|
*(uint32_t*)(reportpacket->data) = data; |
|
|
|
|
|
*(uint32_t*)(reportpacket->data + 4) = data2; |
|
|
|
|
|
*(uint32_t*)(reportpacket->data + 8) = data3; |
|
|
|
|
|
|
|
|
reportpacket->data[i * 9 + 0] = ((data[i].data0)) >> 0; |
|
|
|
|
|
reportpacket->data[i * 9 + 1] = ((data[i].data0)) >> 8; |
|
|
|
|
|
reportpacket->data[i * 9 + 2] = ((data[i].data0)) >> 16; |
|
|
|
|
|
|
|
|
// reportpacket->data[12] = 0xFE; |
|
|
|
|
|
// reportpacket->data[13] = 0xEF; |
|
|
|
|
|
|
|
|
reportpacket->data[i * 9 + 3] = ((data[i].data1)) >> 0; |
|
|
|
|
|
reportpacket->data[i * 9 + 4] = ((data[i].data1)) >> 8; |
|
|
|
|
|
reportpacket->data[i * 9 + 5] = ((data[i].data1)) >> 16; |
|
|
|
|
|
|
|
|
uint16_t sendlen = sizeof(heartrate_report_packet_t) + 4 * 3; |
|
|
|
|
|
|
|
|
reportpacket->data[i * 9 + 6] = ((data[i].data2)) >> 0; |
|
|
|
|
|
reportpacket->data[i * 9 + 7] = ((data[i].data2)) >> 8; |
|
|
|
|
|
reportpacket->data[i * 9 + 8] = ((data[i].data2)) >> 16; |
|
|
|
|
|
} |
|
|
|
|
|
uint16_t sendlen = sizeof(heartrate_report_packet_t) + ndata * 9; |
|
|
|
|
|
ZLOGI("report data %d %d", sendlen, ndata); |
|
|
zdatachannel_data_send2(m_reportbuf, sendlen); |
|
|
zdatachannel_data_send2(m_reportbuf, sendlen); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
@ -505,10 +508,10 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { // |
|
|
static int cnt = 0; |
|
|
static int cnt = 0; |
|
|
cnt++; |
|
|
cnt++; |
|
|
if (DeviceCtrl_now_state() == kdevice_state_sampling && cnt % 10 == 0) { |
|
|
if (DeviceCtrl_now_state() == kdevice_state_sampling && cnt % 10 == 0) { |
|
|
uint8_t drop0 = hwss_get_drop_state0(); |
|
|
|
|
|
uint8_t drop1 = hwss_get_drop_state1(); |
|
|
|
|
|
ZLOGI("[%d] drop %s", znordic_getpower_on_ms(), dropstate(drop0, drop1)); |
|
|
|
|
|
prvf_try_report_sensor_drop_event(drop0, drop1); |
|
|
|
|
|
|
|
|
// uint8_t drop0 = hwss_get_drop_state0(); |
|
|
|
|
|
// uint8_t drop1 = hwss_get_drop_state1(); |
|
|
|
|
|
// ZLOGI("[%d] drop %s", znordic_getpower_on_ms(), dropstate(drop0, drop1)); |
|
|
|
|
|
// prvf_try_report_sensor_drop_event(drop0, drop1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else if (event->eventType == kevent_sample_stop_event) { |
|
|
} else if (event->eventType == kevent_sample_stop_event) { |
|
@ -518,9 +521,7 @@ static void app_event_listener(void* p_event_data, uint16_t event_size) { // |
|
|
if (m_realtime_report_state) { |
|
|
if (m_realtime_report_state) { |
|
|
// 上报采样数据 |
|
|
// 上报采样数据 |
|
|
prvf_report_sample_data(event->val.little_data_block.frameIndex, // |
|
|
prvf_report_sample_data(event->val.little_data_block.frameIndex, // |
|
|
event->val.little_data_block.data[0].data0, // |
|
|
|
|
|
event->val.little_data_block.data[0].data1, // |
|
|
|
|
|
event->val.little_data_block.data[0].data2); |
|
|
|
|
|
|
|
|
event->val.little_data_block.data, LITTLE_DATA_BLOCK_FRAME_NUM); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|