2025-04-23T15:33:38

This commit is contained in:
yuntang 2025-04-23 15:33:39 +08:00
parent 658c68b3ce
commit 12d4c03b3d
17 changed files with 307 additions and 170 deletions

Binary file not shown.

Binary file not shown.

View File

@ -195,7 +195,10 @@ void XlsxHandler::writeFile(const QString filePath)
xlsx.write(row , 2, edVtr.size()); xlsx.write(row , 2, edVtr.size());
row++; row++;
logde<<"edVtr size:"<<edVtr.size();
for(int index = 0;index < edVtr.size();index++){ for(int index = 0;index < edVtr.size();index++){
logde<<"index :"<<index;
const Global::ExperimentData & ed = edVtr.at(index); const Global::ExperimentData & ed = edVtr.at(index);
xlsx.write(row , 1, index); xlsx.write(row , 1, index);

View File

@ -5,8 +5,10 @@ Mode _mode;
QVector<CurveFileData> _curveFileDataVtr; QVector<CurveFileData> _curveFileDataVtr;
int _currentPhase = 0;
ExperimentInfo _experimentInfo; ExperimentInfo _experimentInfo;
QVector<CurveExperimentData> _curveExperimentDataVtr; QVector<CurveExperimentData> _curveExperimentDataVtr;
CurveExperimentData* _currentCurveExperimentDataPtr = nullptr;
bool _enthalpyCoefficientEnableFlag = false; bool _enthalpyCoefficientEnableFlag = false;
QVector<double> _enthalpyCoefficientVtr; QVector<double> _enthalpyCoefficientVtr;

View File

@ -76,8 +76,10 @@ extern Mode _mode;
// Xlsx file data. // Xlsx file data.
extern QVector<CurveFileData> _curveFileDataVtr; extern QVector<CurveFileData> _curveFileDataVtr;
// Experiment setting data. // Experiment setting data.
extern int _currentPhase;
extern ExperimentInfo _experimentInfo; extern ExperimentInfo _experimentInfo;
extern QVector<CurveExperimentData> _curveExperimentDataVtr; extern QVector<CurveExperimentData> _curveExperimentDataVtr;
extern CurveExperimentData* _currentCurveExperimentDataPtr;
// Instrument coefficient. // Instrument coefficient.
extern bool _enthalpyCoefficientEnableFlag; extern bool _enthalpyCoefficientEnableFlag;

View File

@ -62,8 +62,8 @@ int main(int argc, char *argv[])
// ExperimentSettingForm es; // ExperimentSettingForm es;
// es.show(); // es.show();
// CentralWidget central; // CentralWidget central;
// central.show(); // central.show();
// SerialPort::parserTest(); // SerialPort::parserTest();

View File

@ -132,11 +132,14 @@ void MainWindow::connections()
connect(SerialPort::instance(), &SerialPort::sigSendPhaseInfo, connect(SerialPort::instance(), &SerialPort::sigSendPhaseInfo,
_expertmentSettingForm, &ExperimentSettingForm::slotRecvPhaseInfo); _expertmentSettingForm, &ExperimentSettingForm::slotRecvPhaseInfo);
connect(SerialPort::instance(), &SerialPort::sigAxisModify,
_centralWidget, &CentralWidget::slotAxisModify);
#endif #endif
// mode // mode
// connect(Global::instance(), &Global::sigModeModify, // connect(Global::instance(), &Global::sigModeModify,
// _centralWidget, &CentralWidget::slotModeModify); // _centralWidget, &CentralWidget::slotModeModify);
//analysis //analysis
connect(_leftWidget,&LeftWidget::sigSendAnalysisFileName, connect(_leftWidget,&LeftWidget::sigSendAnalysisFileName,
_centralWidget,&CentralWidget::slotRecvAnalysisFileName); _centralWidget,&CentralWidget::slotRecvAnalysisFileName);
@ -216,7 +219,7 @@ void MainWindow::on_actionStop_triggered()
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Stop); QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Stop);
SerialPort::instance()->slotSendData(ba); SerialPort::instance()->slotSendData(ba);
#if 0 #if 1
// Save data. // Save data.
if(saveExperimentFile(Global::_experimentInfo.sampleName)){ if(saveExperimentFile(Global::_experimentInfo.sampleName)){
_leftWidget->reloadFileName(); _leftWidget->reloadFileName();
@ -376,3 +379,10 @@ void MainWindow::on_actionEnthalpyCorrectionSelection_triggered()
{ {
_coefficientSelectionForm->show(); _coefficientSelectionForm->show();
} }
void MainWindow::on_actionSaveExperimentData_triggered()
{
if(saveExperimentFile(Global::_experimentInfo.sampleName)){
_leftWidget->reloadFileName();
}
}

View File

@ -81,6 +81,8 @@ private slots:
void on_actionEnthalpyCorrectionSelection_triggered(); void on_actionEnthalpyCorrectionSelection_triggered();
void on_actionSaveExperimentData_triggered();
private: private:
void connections(); void connections();
void setActionEnable(const bool); void setActionEnable(const bool);

View File

@ -28,6 +28,7 @@
<string>文件</string> <string>文件</string>
</property> </property>
<addaction name="actionNew"/> <addaction name="actionNew"/>
<addaction name="actionSaveExperimentData"/>
</widget> </widget>
<widget class="QMenu" name="menu_2"> <widget class="QMenu" name="menu_2">
<property name="title"> <property name="title">
@ -265,6 +266,14 @@
<string>热焓校正系数选择</string> <string>热焓校正系数选择</string>
</property> </property>
</action> </action>
<action name="actionSaveExperimentData">
<property name="text">
<string>保存实验数据</string>
</property>
<property name="toolTip">
<string>保存实验数据</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="images.qrc"/> <include location="images.qrc"/>

View File

@ -9,8 +9,8 @@
namespace DataParser namespace DataParser
{ {
bool commonDataParser(const QByteArray &ba, CommonData &cd) bool commonDataParser(const QByteArray &ba, CommonData &cd)
{ {
const char *charArray = ba.data(); const char *charArray = ba.data();
// 判断前两个字节是否为 0xA5 和 0x5A (小端格式) // 判断前两个字节是否为 0xA5 和 0x5A (小端格式)
@ -35,12 +35,12 @@ namespace DataParser
memcpy(&cd, charArray + 6, sizeof(CommonData)); memcpy(&cd, charArray + 6, sizeof(CommonData));
return true; return true;
} }
QByteArray connectToDevice(const QVector<Phase> &vtr) QByteArray connectToDevice(const QVector<Phase> &vtr)
{ {
const int phaseLength = sizeof(Phase); const int phaseLength = sizeof(Phase);
const int phaseArrayLength = vtr.size() * phaseLength; const int phaseArrayLength = vtr.size() * phaseLength;
char phaseArray[300] = {}; char phaseArray[300] = {};
@ -88,10 +88,10 @@ namespace DataParser
// //
return QByteArray(totalData, 6 + phaseArrayLength + 2); return QByteArray(totalData, 6 + phaseArrayLength + 2);
} }
QByteArray setDeviceStartStop(const DeviceStartMode mode) QByteArray setDeviceStartStop(const DeviceStartMode mode)
{ {
#if 1 #if 1
SerialPortProtocol spp; SerialPortProtocol spp;
spp.head = FRANE_HEAD; spp.head = FRANE_HEAD;
@ -135,10 +135,41 @@ namespace DataParser
return QByteArray(data,length); return QByteArray(data,length);
#endif #endif
}
void experimentalStateSwitching(const CommonData &cd)
{
switch(cd.run_type){
case DeviceRunStatus::Heat:
case DeviceRunStatus::ConstantTemp:
Global::_mode = Global::Mode::Experiment;
break;
case DeviceRunStatus::Idle:
case DeviceRunStatus::Cooling:
Global::_mode = Global::Mode::Analysis;
break;
default:break;
} }
unsigned short modbusCRC16(unsigned char *data, unsigned short length) if(Global::_currentPhase != (int)cd.current_phase){
{ Global::_currentPhase = (int)cd.current_phase;
// Global::CurveExperimentData ced{nullptr,"",QVector<Global::ExperimentData>()};
Global::CurveExperimentData ced;
Global::_curveExperimentDataVtr.push_back(ced);
Global::_currentCurveExperimentDataPtr = &Global::_curveExperimentDataVtr.last();
Global::_currentCurveExperimentDataPtr->fileName = Global::_experimentInfo.sampleName;
}
logde<<"phase:"<<(int)cd.current_phase;
logde<<"run type:"<<(int)cd.run_type;
logde<<"software mode:"<<Global::_mode;
}
unsigned short modbusCRC16(unsigned char *data, unsigned short length)
{
unsigned short crc = 0xFFFF; unsigned short crc = 0xFFFF;
unsigned char i; unsigned char i;
for (unsigned short j = 0; j < length; j++) for (unsigned short j = 0; j < length; j++)
@ -158,10 +189,10 @@ namespace DataParser
} }
// CRC结果低字节在前高字节在后 // CRC结果低字节在前高字节在后
return crc; return crc;
} }
QByteArray inquirePhaseInfo() QByteArray inquirePhaseInfo()
{ {
SerialPortProtocol spp; SerialPortProtocol spp;
spp.head = FRANE_HEAD; spp.head = FRANE_HEAD;
spp.cmd = READ_CMD; spp.cmd = READ_CMD;
@ -176,21 +207,46 @@ namespace DataParser
int sppValidLength = 6 + 1; int sppValidLength = 6 + 1;
return QByteArray((char *)&spp, sppValidLength) + return QByteArray((char *)&spp, sppValidLength) +
QByteArray((char *)&crc, 2); QByteArray((char *)&crc, 2);
}
bool isDevExperimentEnded(const CommonData &cd)
{
switch(cd.run_type){
case DeviceRunStatus::Heat:
case DeviceRunStatus::ConstantTemp:
Global::_mode = Global::Mode::Experiment;
break;
case DeviceRunStatus::Idle:
logde<<"idle...";
case DeviceRunStatus::Cooling:
Global::_mode = Global::Mode::Analysis;
logde<<"cooling...";
// return true;
break;
default:break;
} }
bool isDevExperimentEnded(const CommonData &cd) #if 0
{ logde<<"phase:"<<(int)cd.current_phase;
logde<<"run type:"<<(int)cd.run_type;
switch(cd.run_type){ switch(cd.run_type){
case DeviceRunStatus::Idle: case DeviceRunStatus::Idle:
logde<<"idle...";
// break;
case DeviceRunStatus::Cooling: case DeviceRunStatus::Cooling:
// Global::instance()->setMode(Global::Mode::Analysis); // Global::instance()->setMode(Global::Mode::Analysis);
// Global::_mode = Global::Mode::Analysis; // Global::_mode = Global::Mode::Analysis;
// logde<<"Device into cooling status,then set the software into annlysis mode."; // logde<<"Device into cooling status,then set the software into annlysis mode.";
return true; logde<<"cooling...";
// return true;
break; break;
default:break; default:break;
} }
return false; return false;
} #endif
}
}; };

View File

@ -13,6 +13,7 @@ QByteArray connectToDevice(const QVector<Phase>&);
QByteArray inquirePhaseInfo(); QByteArray inquirePhaseInfo();
QByteArray setDeviceStartStop(const DeviceStartMode); QByteArray setDeviceStartStop(const DeviceStartMode);
void experimentalStateSwitching(const CommonData&cd);
bool isDevExperimentEnded(const CommonData&cd); bool isDevExperimentEnded(const CommonData&cd);
bool commonDataParser(const QByteArray&ba,CommonData &cd); bool commonDataParser(const QByteArray&ba,CommonData &cd);

View File

@ -94,12 +94,11 @@ void SerialPort::timerEvent(QTimerEvent *event)
void SerialPort::slotReadData() void SerialPort::slotReadData()
{ {
#if 1
QByteArray ba = _sp->readAll(); QByteArray ba = _sp->readAll();
if(ba.size() == 0){ if(ba.size() == 0){
return; return;
} }
#if 1 #if 0
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数 QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
qDebug() << "receive info (hex):" << hexData; qDebug() << "receive info (hex):" << hexData;
#endif #endif
@ -128,19 +127,18 @@ void SerialPort::slotReadData()
} }
else if (READ_CMD == spp->cmd) else if (READ_CMD == spp->cmd)
{ {
// judge the device status. DataParser::experimentalStateSwitching(cd);
DataParser::isDevExperimentEnded(cd); setAxis();
// read data
if (spp->addr == 0) if (spp->addr == 0)
{ {
if (Global::Mode::Experiment == Global::_mode) if (Global::Mode::Experiment == Global::_mode)
{ {
emit sigSendCommonData(cd); emit sigSendCommonData(cd);
} }
emit sigSendCommonDataToRealDataForm(cd); // emit sigSendCommonDataToRealDataForm(cd);
} }
} }
#endif
} }
void SerialPort::commonDataParser(const int dataLength, const u16 addr, void SerialPort::commonDataParser(const int dataLength, const u16 addr,
@ -173,7 +171,7 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
{ {
switch(cd.run_type){ switch(cd.run_type){
case DeviceRunStatus::Cooling: case DeviceRunStatus::Cooling:
// Global::instance()->setMode(Global::Mode::Analysis); // Global::instance()->setMode(Global::Mode::Analysis);
Global::_mode = Global::Mode::Analysis; Global::_mode = Global::Mode::Analysis;
logde<<"set global mode analysis.common data parser."; logde<<"set global mode analysis.common data parser.";
break; break;
@ -201,12 +199,12 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
switch (mode) switch (mode)
{ {
case DeviceStartMode::Stop: case DeviceStartMode::Stop:
// Global::instance()->setMode(Global::Mode::Analysis); // Global::instance()->setMode(Global::Mode::Analysis);
Global::_mode = Global::Mode::Analysis; Global::_mode = Global::Mode::Analysis;
logde<<"set global mode analysis."; logde<<"set global mode analysis.";
break; break;
case DeviceStartMode::Start: case DeviceStartMode::Start:
// Global::instance()->setMode(Global::Mode::ExperimentStart); // Global::instance()->setMode(Global::Mode::ExperimentStart);
Global::_mode = Global::Mode::Experiment; Global::_mode = Global::Mode::Experiment;
break; break;
default: default:
@ -394,6 +392,26 @@ void SerialPort::displayPortInfo()
} }
} }
} }
void SerialPort::setAxis()
{
static Global::Mode previousMode = Global::Analysis; // 记录上一次的模式
if (previousMode == Global::Analysis &&
Global::_mode == Global::Experiment) {
// std::cout << "Mode has changed from Analysis to Experiment!" << std::endl;
Global::ExperimentInfo & eti = Global::_experimentInfo;
if(eti.phaseVtr.size() > 0){
logde<<"serialport set axis.";
float temp = eti.phaseVtr.at(0).cutoff_temp;
emit sigAxisModify(temp);
}
}
if(previousMode != Global::_mode){
previousMode = Global::_mode;
}
}
void SerialPort::parserTest() void SerialPort::parserTest()
{ {
const uchar data[] = {0xa5, 0x5a, 0x2d, 0x83, const uchar data[] = {0xa5, 0x5a, 0x2d, 0x83,

View File

@ -34,6 +34,7 @@ signals:
void sigSendCommonData(const CommonData &); void sigSendCommonData(const CommonData &);
void sigSendCommonDataToRealDataForm(const CommonData &); void sigSendCommonDataToRealDataForm(const CommonData &);
void sigSendPhaseInfo(const QByteArray &); void sigSendPhaseInfo(const QByteArray &);
void sigAxisModify(const float temp);
public slots: public slots:
void slotDeliverData(const QByteArray &); void slotDeliverData(const QByteArray &);
// void slotConnectToDevice(const QByteArray&); // void slotConnectToDevice(const QByteArray&);
@ -46,7 +47,7 @@ private:
void commonDataParser(const int dataLength, const u16 addr, const CommonData &cd); void commonDataParser(const int dataLength, const u16 addr, const CommonData &cd);
void to_hex(char *in_char, int char_length, char *out_char); void to_hex(char *in_char, int char_length, char *out_char);
void displayPortInfo(); void displayPortInfo();
void setAxis();
private: private:
SerialPort(QObject *parent = nullptr); SerialPort(QObject *parent = nullptr);
QSerialPort *_sp; QSerialPort *_sp;

View File

@ -9,8 +9,6 @@ AboutForm::AboutForm(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
// setFixedSize(geometry().width(),geometry().height());
setWindowTitle("About"); setWindowTitle("About");
QPixmap pixmap(":/images/logo.png"); // 假设图片在资源文件中 QPixmap pixmap(":/images/logo.png"); // 假设图片在资源文件中
@ -22,19 +20,16 @@ AboutForm::AboutForm(QWidget *parent) :
ui->labelTitle->setText(QString("<p style=\"font-size: 18px;\">关于差示扫描量热仪数据分析软件</p>")); ui->labelTitle->setText(QString("<p style=\"font-size: 18px;\">关于差示扫描量热仪数据分析软件</p>"));
//#define COMPILE_TIME QString("编译时间:%1 %2").arg(__DATE__).arg(__TIME__)
QString ConCompleTime = QString("编译时间:%1 %2").arg(__DATE__).arg(__TIME__); QString ConCompleTime = QString("编译时间:%1 %2").arg(__DATE__).arg(__TIME__);
QString aboutText = QString( QString aboutText = QString(
"<p>软件版本:%1</p>" "<p>软件版本:%1</p>"
"<p>%2</p>"
"<p>版权所有 © 2025 山东云唐智能科技有限公司 保留所有权</p>" "<p>版权所有 © 2025 山东云唐智能科技有限公司 保留所有权</p>"
"<br>" "<br>"
"<p style=\"font-size: 10px;\">本软件基于 Qt 框架开发Qt 遵循 " "<p style=\"font-size: 10px;\">本软件基于 Qt 框架开发Qt 遵循 "
"<a href='https://www.gnu.org/licenses/lgpl-3.0.html'>LGPL 协议</a>。</p>" "<a href='https://www.gnu.org/licenses/lgpl-3.0.html'>LGPL 协议</a>。</p>"
"<p style=\"font-size: 10px;\">Qt 官网:<a href='https://www.qt.io'>www.qt.io</a></p>") "<p style=\"font-size: 10px;\">Qt 官网:<a href='https://www.qt.io'>www.qt.io</a></p>")
.arg(Global::ConSoftVersion).arg(ConCompleTime); .arg(Global::ConSoftVersion);
ui->labelContent->setAlignment(Qt::AlignTop | Qt::AlignLeft); ui->labelContent->setAlignment(Qt::AlignTop | Qt::AlignLeft);
ui->labelContent->setTextFormat(Qt::RichText); ui->labelContent->setTextFormat(Qt::RichText);

View File

@ -74,15 +74,15 @@ CentralWidget::CentralWidget(QWidget *parent)
_customPlot->yAxis->setRange(0, 100); _customPlot->yAxis->setRange(0, 100);
_customPlot->replot(); _customPlot->replot();
#endif #endif
// startTimer(1000);
// 设置坐标轴标签 // 设置坐标轴标签
_customPlot->xAxis->setLabel("Temp/℃"); _customPlot->xAxis->setLabel("Temp/℃");
_customPlot->yAxis->setLabel("DSC/mW"); _customPlot->yAxis->setLabel("DSC/mW");
// 设置坐标轴范围,以便我们可以看到全部数据 // 设置坐标轴范围,以便我们可以看到全部数据
_customPlot->xAxis->setRange(0, 400); _customPlot->xAxis->setRange(0,100);
_customPlot->yAxis->setRange(-100,200); _customPlot->yAxis->setRange(0,20);
// startTimer(300);
} }
CentralWidget::~CentralWidget() CentralWidget::~CentralWidget()
@ -137,30 +137,47 @@ void CentralWidget::slotModeModify(const Global::Mode mode)
void CentralWidget::slotRecvCommonData(const CommonData &cd) void CentralWidget::slotRecvCommonData(const CommonData &cd)
{ {
qDebug() << "slotRevCommonData"; // logde<<"slotRecvCommonData...";
static double index = 0.0; static double index = 0.0;
if(!_currentCurve){ if(!_currentCurve){
logde<<"_currentCurve is nullptr";
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis); _currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
} }
logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc; logde<<"temp:"<<cd.sample_temp<<",dsc:"<<cd.dsc;
// Update curve. _currentCurve->addData(index++,cd.sample_temp, cd.dsc);
// _currentCurve->addData(cd.sample_temp, cd.dsc);
// _currentCurve->data()->add(QCPCurveData(index++, cd.sample_temp, cd.dsc));
// _currentCurve->addData(index++,cd.sample_temp, cd.dsc); // _customPlot->rescaleAxes();
_customPlot->replot();
// 设置曲线数据 // return;
// _currentCurve->setData(data);
// _customPlot->rescaleAxes();
// _customPlot->replot();
// Record data. // Record data.
logde<<"record data...";
if(!Global::_currentCurveExperimentDataPtr){
logde<<"_currentCurveExperimentDataPtr is nullptr.";
exit(0);
}else{
logde<<"add ed...";
Global::ExperimentData ed;
ed.dsc = cd .dsc;
ed.sampleTemp = cd.sample_temp;
ed.runTime = cd.add_run_time;
ed.constantTempTime = cd.add_constan_temp_time;
Global::_currentCurveExperimentDataPtr->dataVtr.push_back(ed);
logde<<"111";
Global::_currentCurveExperimentDataPtr->curve = _currentCurve;
logde<<"222";
}
#if 0
logde<<"record data...";
QVector<Global::ExperimentData>* pEdVtr = nullptr; // 声明指针变量 QVector<Global::ExperimentData>* pEdVtr = nullptr; // 声明指针变量
for(auto item:Global::_curveExperimentDataVtr){ for(auto item:Global::_curveExperimentDataVtr){
if(item.curve == _currentCurve){ if(item.curve == _currentCurve){
@ -180,12 +197,15 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
ed.constantTempTime = cd.add_constan_temp_time; ed.constantTempTime = cd.add_constan_temp_time;
pEdVtr->push_back(ed); pEdVtr->push_back(ed);
#endif
} }
void CentralWidget::slotRecvAnalysisFileName(const QString &filePath) void CentralWidget::slotRecvAnalysisFileName(const QString &filePath)
{ {
qDebug() << "slotRecvAnalysisFileName" << filePath; qDebug() << "slotRecvAnalysisFileName" << filePath;
_customPlot->setInteractions(QCP::iSelectPlottables);
// todo.禁止重复文件添加。 // todo.禁止重复文件添加。
Global::CurveFileData cfd; Global::CurveFileData cfd;
if(XlsxHandler::readFile(filePath,cfd) != 0){ if(XlsxHandler::readFile(filePath,cfd) != 0){
@ -417,6 +437,9 @@ void CentralWidget::slotAnalysisSettingLineXPoint(const int index, const double)
void CentralWidget::timerEvent(QTimerEvent *event) void CentralWidget::timerEvent(QTimerEvent *event)
{ {
_customPlot->replot();
#if 0
// key的单位是秒 // key的单位是秒
double key = QDateTime::currentDateTime().toMSecsSinceEpoch() / 1000.0; double key = QDateTime::currentDateTime().toMSecsSinceEpoch() / 1000.0;
// 添加数据 // 添加数据
@ -439,6 +462,7 @@ void CentralWidget::timerEvent(QTimerEvent *event)
_customPlot->yAxis->setRange(0, 20); // 设定x轴的范围 _customPlot->yAxis->setRange(0, 20); // 设定x轴的范围
_customPlot->xAxis->setRange(key + 0.25, 80, Qt::AlignRight); // 设定x轴的范围 _customPlot->xAxis->setRange(key + 0.25, 80, Qt::AlignRight); // 设定x轴的范围
_customPlot->replot(); _customPlot->replot();
#endif
} }
void CentralWidget::contextMenuEvent(QContextMenuEvent *event) void CentralWidget::contextMenuEvent(QContextMenuEvent *event)
@ -901,6 +925,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
QCPGraph *graph = _customPlot->graph(i); QCPGraph *graph = _customPlot->graph(i);
_customPlot->removeGraph(graph); _customPlot->removeGraph(graph);
} }
_currentCurve = nullptr;
#endif #endif
// Delete items. // Delete items.
@ -922,3 +947,13 @@ void CentralWidget::clearAllData()
{ {
clearData(ClearDataMode::All); clearData(ClearDataMode::All);
} }
void CentralWidget::slotAxisModify(const float temp)
{
_customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
float value = temp + 20;
_customPlot->xAxis->setRange(10,value);
_customPlot->yAxis->setRange(-5,5);
}

View File

@ -35,6 +35,8 @@ signals:
void sigSendLineXCoord(const int,const double); void sigSendLineXCoord(const int,const double);
void sigRightDockWidgetHide(); void sigRightDockWidgetHide();
public slots: public slots:
// experiment
void slotAxisModify(const float temp);
void slotModeModify(const Global::Mode); void slotModeModify(const Global::Mode);
void slotRecvCommonData(const CommonData&); void slotRecvCommonData(const CommonData&);
void slotRecvAnalysisFileName(const QString&); void slotRecvAnalysisFileName(const QString&);

View File

@ -404,12 +404,12 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
} }
// //
Global::ExperimentInfo& ei = Global::_experimentInfo; Global::ExperimentInfo& ei = Global::_experimentInfo;
ei.phaseVtr = phaseVtr;
ei.sampleName = ui->sampleNameLineEdit->text(); ei.sampleName = ui->sampleNameLineEdit->text();
ei.sampleWeight = ui->sampleWeightLineEdit->text(); ei.sampleWeight = ui->sampleWeightLineEdit->text();
ei.date = ui->dateTimeLineEdit->text(); ei.date = ui->dateTimeLineEdit->text();
ei.experimentor = ui->userLineEdit->text(); ei.experimentor = ui->userLineEdit->text();
#if 0
ei.phaseVtr = phaseVtr;
if(ui->radioButton_OIT->isChecked()){ if(ui->radioButton_OIT->isChecked()){
ei.testType = Global::TestType::OIT; ei.testType = Global::TestType::OIT;
} else if(ui->radioButton_OIT_not->isChecked()){ } else if(ui->radioButton_OIT_not->isChecked()){
@ -417,7 +417,7 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
} }
ei.initialAtmosPhere = (GasType)(ui->comboBox_phase_1_atmosphere->currentIndex()); ei.initialAtmosPhere = (GasType)(ui->comboBox_phase_1_atmosphere->currentIndex());
#endif
// //
QByteArray ba = DataParser::connectToDevice(phaseVtr); QByteArray ba = DataParser::connectToDevice(phaseVtr);
qDebug() << "ba size:" << ba.size(); qDebug() << "ba size:" << ba.size();
@ -497,6 +497,7 @@ void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba)
Phase *phase = (Phase *)(data + i * PHASE_BYTE_SIZE); Phase *phase = (Phase *)(data + i * PHASE_BYTE_SIZE);
phaseVtr.push_back(*phase); phaseVtr.push_back(*phase);
} }
Global::_experimentInfo.phaseVtr = phaseVtr;
//ui update //ui update
for(int i = 0; i< phaseVtr.size();){ for(int i = 0; i< phaseVtr.size();){