From eb1bdc95dc7ef281d12f44991ea928ca0a6a70a0 Mon Sep 17 00:00:00 2001 From: iorebuild Date: Thu, 30 Apr 2026 13:26:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=80=9A=E9=81=93=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E4=B8=8D=E5=8B=BE=E9=80=89=EF=BC=8CCSV=E4=B8=8D?= =?UTF-8?q?=E5=8A=A0=E8=A1=A8=E5=A4=B4=E4=BF=9D=E5=AD=98=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 所有16个通道复选框默认不勾选 - CSV文件直接写原始数据,不加ch0-ch15表头 - 修复autoRangeY在无可见通道时的逻辑 --- datamanager.cpp | 10 ---------- plotwidget.cpp | 6 +++++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/datamanager.cpp b/datamanager.cpp index e759e73..65dddb5 100644 --- a/datamanager.cpp +++ b/datamanager.cpp @@ -67,16 +67,6 @@ void DataManager::appendDataPoint(const QVector &values) { if (!m_recording) return; - if (!m_headerWritten) { - // 写入表头 - QStringList headers; - for (int i = 0; i < 16; ++i) { - headers << QString("ch%1").arg(i); - } - m_stream << headers.join(",") << "\n"; - m_headerWritten = true; - } - QStringList parts; for (int v : values) { parts << QString::number(v); diff --git a/plotwidget.cpp b/plotwidget.cpp index adfb241..af3adaa 100644 --- a/plotwidget.cpp +++ b/plotwidget.cpp @@ -26,7 +26,7 @@ PlotWidget::PlotWidget(QWidget *parent) , m_dirty(true) { m_data.resize(16); - m_channelVisible.fill(true, 16); + m_channelVisible.fill(false, 16); m_colors = defaultColors(); setMouseTracking(true); @@ -149,6 +149,10 @@ void PlotWidget::autoRangeY() } } + if (globalMax < globalMin) { + // 没有可见通道或没有数据 + return; + } if (globalMax - globalMin < 1.0) { globalMin -= 50; globalMax += 50;