Browse Source

update

master
zhaohe 1 year ago
parent
commit
f77203c137
  1. 48
      mainwindow.cpp
  2. 4
      mainwindow.ui

48
mainwindow.cpp

@ -20,6 +20,8 @@ using namespace iflytop;
typedef enum { typedef enum {
kone_lead_ecg, kone_lead_ecg,
kthree_lead_ecg, kthree_lead_ecg,
kone_lead_ecg_v2,
} device_type_t; } device_type_t;
static MainWindow *m_mainWindow; static MainWindow *m_mainWindow;
@ -226,12 +228,15 @@ void MainWindow::constructUI() {
{ {
ui->deviceType->addItem("单导联一代(M1001)"); ui->deviceType->addItem("单导联一代(M1001)");
ui->deviceType->addItem("三导联一代(M1002)"); ui->deviceType->addItem("三导联一代(M1002)");
ui->deviceType->addItem("单导联二代(M1003)");
ui->deviceType->setCurrentIndex(0); ui->deviceType->setCurrentIndex(0);
connect(ui->deviceType, &QComboBox::currentTextChanged, this, [this](const QString &text) { connect(ui->deviceType, &QComboBox::currentTextChanged, this, [this](const QString &text) {
if (text == "单导联一代(M1001)") { if (text == "单导联一代(M1001)") {
m_devicetype = kone_lead_ecg; m_devicetype = kone_lead_ecg;
} else if (text == "三导联一代(M1002)") { } else if (text == "三导联一代(M1002)") {
m_devicetype = kthree_lead_ecg; m_devicetype = kthree_lead_ecg;
} else if (text == "单导联二代(M1003)") {
m_devicetype = kone_lead_ecg_v2;
} }
}); });
} }
@ -242,15 +247,24 @@ void MainWindow::constructUI() {
switch (reportType) { switch (reportType) {
case ify_hrs_report_heartrate_data: { case ify_hrs_report_heartrate_data: {
heartrate_report_packet_t *heartrate_report = (heartrate_report_packet_t *)report_packet; heartrate_report_packet_t *heartrate_report = (heartrate_report_packet_t *)report_packet;
if (m_devicetype == kone_lead_ecg) { if (m_devicetype == kone_lead_ecg) {
static uint32_t lastpacket_index = 0;
static uint32_t lostpacket = 0;
if ((lastpacket_index + 5) != (heartrate_report->sample_data_index)) {
lostpacket++;
}
lastpacket_index = heartrate_report->sample_data_index;
reportPreviewShow("[preview data ] lost:%d index %d", lostpacket, heartrate_report->sample_data_index);
if (checkok) { if (checkok) {
uint16_t data0 = (uint16_t)(heartrate_report->data[0]) + ((uint16_t)heartrate_report->data[1] << 8); uint16_t data0 = (uint16_t)(heartrate_report->data[0]) + ((uint16_t)heartrate_report->data[1] << 8);
uint16_t data1 = (uint16_t)(heartrate_report->data[2]) + ((uint16_t)heartrate_report->data[3] << 8); uint16_t data1 = (uint16_t)(heartrate_report->data[2]) + ((uint16_t)heartrate_report->data[3] << 8);
uint16_t data2 = (uint16_t)(heartrate_report->data[4]) + ((uint16_t)heartrate_report->data[5] << 8); uint16_t data2 = (uint16_t)(heartrate_report->data[4]) + ((uint16_t)heartrate_report->data[5] << 8);
uint16_t data3 = (uint16_t)(heartrate_report->data[6]) + ((uint16_t)heartrate_report->data[7] << 8); uint16_t data3 = (uint16_t)(heartrate_report->data[6]) + ((uint16_t)heartrate_report->data[7] << 8);
uint16_t data4 = (uint16_t)(heartrate_report->data[8]) + ((uint16_t)heartrate_report->data[9] << 8); uint16_t data4 = (uint16_t)(heartrate_report->data[8]) + ((uint16_t)heartrate_report->data[9] << 8);
emit doinui_signal(QFunction([this, data0, data1, data2, data3, data4]() { // emit doinui_signal(QFunction([this, data0, data1, data2, data3, data4]() { //
reportPreviewShow("[preview data ] index %llu %d", data0);
wp2d->addData("心电", data0, 0); wp2d->addData("心电", data0, 0);
wp2d->addData("心电", data1, 2); wp2d->addData("心电", data1, 2);
wp2d->addData("心电", data2, 4); wp2d->addData("心电", data2, 4);
@ -262,23 +276,25 @@ void MainWindow::constructUI() {
})); }));
} }
} else if (m_devicetype == kthree_lead_ecg) { } else if (m_devicetype == kthree_lead_ecg) {
} else if (m_devicetype == kone_lead_ecg_v2) {
if (checkok) {
uint32_t packetlen = len - sizeof(heartrate_report_packet_t);
static uint32_t lastpacket_index = 0;
static uint32_t lostpacket = 0;
if ((lastpacket_index + 50) != (heartrate_report->sample_data_index)) {
lostpacket++;
} }
lastpacket_index = heartrate_report->sample_data_index;
reportPreviewShow("[preview data ] lost:%d index %d %d", lostpacket, heartrate_report->sample_data_index, packetlen);
// heartrate_report->data[]
// uin
// uint16_t header = 0xA55A;
// uint16_t tail = 0xB55B;
// G_WaveDataChannel.send((uint8_t *)&header, sizeof(header));
// G_WaveDataChannel.send((uint8_t *)report_packet, len);
// G_WaveDataChannel.send((uint8_t *)&tail, sizeof(tail));
// if (m_devicetype == kone_lead_ecg) {
// reportPreviewShow("[preview data ] checksum_ok:%d index %llu", checkok, heartrate_report->sample_data_index);
// } else if (m_devicetype == kthree_lead_ecg) {
// displayWave(heartrate_report->data[0], heartrate_report->data[1], heartrate_report->data[2]);
// }
// break;
int32_t *frame = (int32_t *)heartrate_report->data;
for (int i = 0; i < 50; i++) {
int32_t data = frame[i];
emit doinui_signal(QFunction([this, data, i]() { wp2d->addData("心电", data, i * 2); }));
}
}
}
break;
} }
case ify_hrs_report_battery_level: { case ify_hrs_report_battery_level: {
reportPreviewShow("[battery_level ]"); reportPreviewShow("[battery_level ]");

4
mainwindow.ui

@ -804,6 +804,10 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;M1001 单导心电记录仪-1代&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;M1002 三导心电记录仪-1代&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;M1003 单导心电记录仪-2代&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;注意事项:&lt;/span&gt;&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;注意事项:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;1.当检查上传数据的CHECKSUM(检验和)时,需要先复位下蓝牙主机开发板清空统计信息&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; color:#ff0000;&quot;&gt;1.当检查上传数据的CHECKSUM(检验和)时,需要先复位下蓝牙主机开发板清空统计信息&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>

Loading…
Cancel
Save