From 374a48022bc47f7d66dfb2e5e8bf7ed86f386ce0 Mon Sep 17 00:00:00 2001 From: tangchao0503 <735056338@qq.com> Date: Sun, 9 Oct 2022 23:00:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E5=BE=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=201.=20=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=9C=A8=E7=A8=8B=E5=BA=8F=E6=89=80=E5=9C=A8=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=EF=BC=9B=202.=20csv=E6=96=87=E4=BB=B6=EF=BC=88ximea?= =?UTF-8?q?=E6=B8=A9=E5=BA=A6=EF=BC=89=E8=BE=93=E5=87=BA=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=EF=BC=9A/home/programRunLog/hyperspectralLog?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Header_Files/configfile.h | 2 ++ Header_Files/ximeaimager.h | 1 + Source_Files/configfile.cpp | 8 ++++---- Source_Files/ximeaimager.cpp | 13 +++++++++++-- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Header_Files/configfile.h b/Header_Files/configfile.h index 8237569..56d2af2 100644 --- a/Header_Files/configfile.h +++ b/Header_Files/configfile.h @@ -12,6 +12,8 @@ #include #include +#include +#include using namespace std; using namespace libconfig; diff --git a/Header_Files/ximeaimager.h b/Header_Files/ximeaimager.h index f5f698f..c35c623 100644 --- a/Header_Files/ximeaimager.h +++ b/Header_Files/ximeaimager.h @@ -29,6 +29,7 @@ #include #include #include +#include #include "configfile.h" diff --git a/Source_Files/configfile.cpp b/Source_Files/configfile.cpp index 2de81f8..e450b72 100644 --- a/Source_Files/configfile.cpp +++ b/Source_Files/configfile.cpp @@ -159,7 +159,6 @@ bool Configfile::createConfigFile() using namespace std; using namespace libconfig; - static const char *output_file = "ximea.cfg"; Config cfg; Setting &root = cfg.getRoot(); @@ -208,15 +207,16 @@ bool Configfile::createConfigFile() // Write out the new configuration. + QString output_file = QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + "ximea.cfg"); try { - cfg.writeFile(output_file); - cerr << "New configuration successfully written to: " << output_file << endl; + cfg.writeFile(output_file.toStdString().c_str()); + cerr << "New configuration successfully written to: " << output_file.toStdString().c_str() << endl; } catch(const FileIOException &fioex) { - cerr << "I/O error while writing configuration file: " << output_file << endl; + cerr << "I/O error while writing configuration file: " << output_file.toStdString().c_str() << endl; return true; } diff --git a/Source_Files/ximeaimager.cpp b/Source_Files/ximeaimager.cpp index e1a756e..c8c536d 100644 --- a/Source_Files/ximeaimager.cpp +++ b/Source_Files/ximeaimager.cpp @@ -9,7 +9,8 @@ XimeaImager::XimeaImager() //connect(this, SIGNAL(recordFinished()),this, SLOT()); - m_configfile.setConfigfilePath("ximea.cfg"); + QString ximeaCfgFile = QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + "ximea.cfg"); + m_configfile.setConfigfilePath(ximeaCfgFile.toStdString()); if(!m_configfile.isConfigfileExist()) m_configfile.createConfigFile(); m_configfile.parseConfigfile(); @@ -80,7 +81,10 @@ void XimeaImager::openImger() m_iImagerState = 101; emit ximeaImageStatus(m_iImagerState); - m_ximeaTemperatureCSVPath = "/home/rock/programRunLog/ximeaTemperature.csv"; + QDateTime curDateTime = QDateTime::currentDateTime(); + QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss"); + m_ximeaTemperatureCSVPath = QDir::cleanPath(QString::fromStdString("/home/programRunLog/hyperspectralLog") + QDir::separator() + "ximeaTemperature_" + currentTime + ".csv"); +// m_ximeaTemperatureCSVPath = "/home/ximeaTemperature.csv"; emit recordXimeaTemperatureSignal(m_ximeaTemperatureCSVPath); } catch(int xiApiErrorCodes) @@ -480,6 +484,10 @@ void XimeaImager::startRecord(double TimeDifferenceBetweensOSAndSbg,QString base // { // break; // } +// if(m_iFrameCounter/getFramerate() > 5*60) //这个判断会导致丢帧率的大幅升高:5% → 20%,推测原因:除法耗时; +// { +// break; +// } // unsigned char pixel = *(unsigned char*)image.bp;//Default value: XI_MONO8 // unsigned short pixel =*(unsigned short*)image.bp;//XI_RAW16 @@ -669,6 +677,7 @@ void XimeaImager::processXiApiErrorCodes(int xiApiErrorCodes) ofstream ximeaErrorFile(ximeaError.toStdString().c_str(),ios::app); ximeaErrorFile<< xiApiErrorCodes << "\n"; + std::cout<<"XimeaImager::processXiApiErrorCodes-----------:未处理ximea异常代码:"<< xiApiErrorCodes <