diff --git a/.vs/IRIS_FODIS/v17/Browse.VC.db b/.vs/IRIS_FODIS/v17/Browse.VC.db index 4872002..02e1615 100644 Binary files a/.vs/IRIS_FODIS/v17/Browse.VC.db and b/.vs/IRIS_FODIS/v17/Browse.VC.db differ diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index af707b8..4d88c94 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -1,6 +1,4 @@ { - "DevContainersInfoBarHidden": true, - "ActiveTargetSystem": "172.16.0.83", "OutputFoldersPerTargetSystem": { "本地计算机": [ "out\\build\\Linux-GCC-Debug", @@ -9,36 +7,11 @@ "out\\install\\x64-Debug", "out\\build\\Linux-GCC-Debug-Nanopi-Air", "out\\install\\Linux-GCC-Debug-Nanopi-Air" - ], - "172.16.0.74": [ - "out\\build\\Linux-GCC-Debug", - "out\\install\\Linux-GCC-Debug", - "out\\build\\x64-Debug", - "out\\install\\x64-Debug", - "out\\build\\Linux-GCC-Debug-Nanopi-Air", - "out\\install\\Linux-GCC-Debug-Nanopi-Air" - ], - "172.16.0.83": [ - "out\\build\\Linux-GCC-Debug", - "out\\install\\Linux-GCC-Debug", - "out\\build\\x64-Debug", - "out\\install\\x64-Debug", - "out\\build\\Linux-GCC-Debug-Nanopi-Air", - "out\\install\\Linux-GCC-Debug-Nanopi-Air" ] }, "ExpandedNodes": [ - "", - "\\Source", - "\\Source\\Calibration", - "\\Source\\FS", - "\\Source\\GPS", - "\\Source\\Logger", - "\\Source\\OSIF", - "\\Source\\OSIF\\include", - "\\Source\\Settings", - "\\Source\\ZZ_SDK" + "" ], - "SelectedNode": "\\Source\\FS\\DataFileProcessor.cpp", + "SelectedNode": "\\main.cpp", "PreviewInSolutionExplorer": false } \ No newline at end of file diff --git a/.vs/cmake.db b/.vs/cmake.db index 1eda8bc..4bf2c1a 100644 Binary files a/.vs/cmake.db and b/.vs/cmake.db differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index b214a2f..e7d2e92 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b9be12..ee3da76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,9 @@ cmake_minimum_required (VERSION 3.5) project ("IRIS_FODIS") -IF (WIN32) -set(CMAKE_PREFIX_PATH "D:/Qt/Qt5.14.2/5.14.2/msvc2017_64/" ${CMAKE_PREFIX_PATH}) -ENDIF () +#IF (WIN32) +#set(CMAKE_PREFIX_PATH "D:/Qt/Qt5.14.2/5.14.2/msvc2017_64/" ${CMAKE_PREFIX_PATH}) +#ENDIF () set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) diff --git a/CMakeSettings.json b/CMakeSettings.json index 4ecb62a..47cbf90 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -10,7 +10,7 @@ "ctestCommandArgs": "", "inheritEnvironments": [ "linux_arm" ], "intelliSenseMode": "linux-gcc-arm", - "remoteMachineName": "-196451390;172.16.0.113 (username=root, port=22, authentication=Password)", + "remoteMachineName": "-1839682806;172.16.0.87 (username=root, port=22, authentication=Password)", "remoteCMakeListsRoot": "/home/pi/FODIS/src/", "remoteBuildRoot": "/home/pi/FODIS/build_d/${name}", "remoteInstallRoot": "/home/pi/FODIS/out/install/${name}", diff --git a/Source/Calibration/MakeDarkCurrentTable.cpp b/Source/Calibration/MakeDarkCurrentTable.cpp index 33b4b86..db7d646 100644 --- a/Source/Calibration/MakeDarkCurrentTable.cpp +++ b/Source/Calibration/MakeDarkCurrentTable.cpp @@ -186,8 +186,8 @@ int MakeDCT::LoadTable() bool bRes = qfData.open(QFile::ReadOnly); if (!bRes) { - //qDebug() << "LoadTable open Failed."; - printf("LoadTable open Failed."); + qDebug() << "LoadTable open Failed."; + //printf("LoadTable open Failed."); return 1; } QString qstrTemp; @@ -202,7 +202,7 @@ int MakeDCT::LoadTable() for (int i=0;i< qsList.size()-1;i++) { dfTemp.lData[i] = qsList[i + 1].toInt(); - qDebug() << qsList[i] << ";"; + //qDebug() << qsList[i] << ";"; } m_vecDataFrame.push_back(dfTemp); qDebug() << qsList.size() << endl; diff --git a/Source/FS/ATPControl_Serial_QT.cpp b/Source/FS/ATPControl_Serial_QT.cpp index 0ea575e..581e1ff 100644 --- a/Source/FS/ATPControl_Serial_QT.cpp +++ b/Source/FS/ATPControl_Serial_QT.cpp @@ -655,7 +655,7 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame& dfData) qbSend.resize(3); // qbSend[1] = 0x00; // qbSend[2] = 0x01; - qbSend[1] = m_iExposureTime >> 8;; + qbSend[1] = m_iExposureTime >> 8; qbSend[2] = m_iExposureTime & 0xFF; int iRes = SendCommand(qbSend); if (iRes != 0) @@ -691,8 +691,6 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame& dfData) for (size_t i = 0; i < iDataSizeInPixel; i++) { dfData.lData[i] = qToBigEndian(usData[i]); - - } // for (int i = 0; i < iDataSizeInPixel; i++) // { diff --git a/Source/FS/DataFileProcessor.cpp b/Source/FS/DataFileProcessor.cpp index 5394c0e..fcc07c1 100644 --- a/Source/FS/DataFileProcessor.cpp +++ b/Source/FS/DataFileProcessor.cpp @@ -191,9 +191,17 @@ void DataFileProcessor::RecoverBackground(QString qstrDataFileName, QString qstr vecExpotime.push_back(dfDataTemp.usExposureTimeInMS); vecDTime.push_back(dfDataTemp.dTimes); - int iB = dfDataTemp.usExposureTimeInMS % 10; - - m_dfBackground = m_vecDataFrame[iB]; + if (dfDataTemp.usExposureTimeInMS<10) + { + int iB = dfDataTemp.usExposureTimeInMS % 10; + m_dfBackground = m_vecDataFrame[iB]; + } + else if (dfDataTemp.usExposureTimeInMS >=10&& dfDataTemp.usExposureTimeInMS<=99) + { + int iA = dfDataTemp.usExposureTimeInMS / 10; + m_dfBackground = m_vecDataFrame[8 + iA]; + } + for (int i = 0; i < 2048 ; i++) { diff --git a/Source/GPS/BD357Ctrl.cpp b/Source/GPS/BD357Ctrl.cpp index 59bf578..49f0e7c 100644 --- a/Source/GPS/BD357Ctrl.cpp +++ b/Source/GPS/BD357Ctrl.cpp @@ -152,6 +152,13 @@ int BD357Controller::Initialize(GPSInfo &struGPSI) +int BD357Controller::VSlot_SkipSyncDateOnce() +{ + emit Signal_StartCapture(); + qDebug() << "Signal_StartCapture"; + return 0; +} + int BD357Controller::ZZ_FormatTime(ZZ_U8 u8Year, ZZ_U8 u8Month, ZZ_U8 u8Day, ZZ_U8 u8Hour, ZZ_U8 u8Minute, ZZ_U8 u8Second) { int iYear = u8Year + 2000; diff --git a/Source/GPS/BD357Ctrl.h b/Source/GPS/BD357Ctrl.h index 1245cba..a3affe8 100644 --- a/Source/GPS/BD357Ctrl.h +++ b/Source/GPS/BD357Ctrl.h @@ -24,6 +24,9 @@ public: int SyncDateOnce(); int StartContinuousUpdating(); int Initialize(GPSInfo &struGPSI); + + //test func + int VSlot_SkipSyncDateOnce(); private: int ZZ_FormatTime(ZZ_U8 u8Year,ZZ_U8 u8Month, ZZ_U8 u8Day, ZZ_U8 u8Hour, ZZ_U8 u8Minute, ZZ_U8 u8Second); public slots: diff --git a/main.cpp b/main.cpp index ea638f7..5b5e499 100644 --- a/main.cpp +++ b/main.cpp @@ -6,8 +6,39 @@ #include "ZZ_Types.h" #include "DataFileProcessor.h" #include "MakeDarkCurrentTable.h" +#include +#include +#include +#include using namespace std; +bool is_mounted(const std::string& device, const std::string& mount_point) +{ + std::ifstream mounts("/proc/mounts"); + std::string line; + + if (mounts.is_open()) + { + while (getline(mounts, line)) + { + std::istringstream iss(line); + std::string dev, mnt, fstype, options; + + if (iss >> dev >> mnt >> fstype >> options) + { + if (dev == device && mnt == mount_point) + { + mounts.close(); + return true; + } + } + } + mounts.close(); + } + + return false; +} + int main(int argc, char* argv[]) { using namespace ZZ_MISCDEF::ZZ_RUNPARAMS; @@ -15,17 +46,42 @@ int main(int argc, char* argv[]) QCoreApplication a(argc, argv); - QEventLoop qeLoop; - QTimer::singleShot(30000, &qeLoop, SLOT(quit())); - qeLoop.exec(); - //ָʾµÆ¿ØÖÆ + //system("sudo mount / dev / mmcblk1p1 / home / data"); system("gpio mode 4 out"); system("gpio mode 5 out"); qDebug() << "system(gpio mode 4 out)"; qDebug() << "system(gpio mode 5 out)"; + ///check tf card + std::string device = "/dev/mmcblk1p1"; + std::string mount_point = "/home/data"; + if (!is_mounted(device, mount_point)/*1*/) + { + while (1) + { + system("gpio write 4 1"); + QEventLoop qeLoop; + QTimer::singleShot(200, &qeLoop, SLOT(quit())); + qeLoop.exec(); + system("gpio write 4 0"); + system("gpio write 5 1"); + + QTimer::singleShot(200, &qeLoop, SLOT(quit())); + qeLoop.exec(); + system("gpio write 5 0"); + } + } + + + QEventLoop qeLoop; + QTimer::singleShot(30000, &qeLoop, SLOT(quit())); + //QTimer::singleShot(10000, &qeLoop, SLOT(quit())); + qeLoop.exec(); + + + OneFSContext m_struFSParam;//²ÎÊýÀà GPSInfo m_struGPSInfo; //FodisRP m_struMiscRunParams; @@ -35,15 +91,17 @@ int main(int argc, char* argv[]) CMainGrabber m_mgMainGrabber;//Ö÷²É¼¯ DataFileProcessor m_dfpDataSaver; +#ifndef WIN32 + QT_LOG::ZZ_InitLogger("/home/data/Log/"); //test +#endif //////////////////////////////////////////////////////////////////////////test code block //DataFrame aaaa; //int xxxx = sizeof(aaaa); //m_dfpDataSaver.LoadWaveLengthFile("E:/WavelengthInfo.txt"); - //m_dfpDataSaver.LoadSingleDataFile("D:/15_55_18.datrecv"); - //m_dfpDataSaver.RecoverBackground("D:/15_55_18.dat", "D:/DCTable.txt"); + //m_dfpDataSaver.LoadSingleDataFile("D:/Data/2023_07_04/15_55_18.dat"); + //m_dfpDataSaver.RecoverBackground("D:/Data/2023_07_04/15_55_18.dat", "D:/DCTable.txt"); //////////////////////////////////////////////////////////////////////////test code block - //////////////////////////////////////////////////////////////////////////Check Settings File bool bRes = false; @@ -71,9 +129,27 @@ int main(int argc, char* argv[]) return -2; } } + else + { + int iSize = m_qfiSettingFileInfo.size(); + if (iSize<50) + { + bool bRes = QFile::remove("/home/data/Setting/DeviceSettings.ini"); + if (!bRes) + { + qDebug() << " QFile::remove Failed."; + return -2; + } + + bRes = QFile::copy("/root/DeviceSettings.ini", "/home/data/Setting/DeviceSettings.ini"); + if (!bRes) + { + qDebug() << " QFile::copy Failed."; + return -2; + } + } + } //////////////////////////////////////////////////////////////////////////Check Settings File - - //////////////////////////////////////////////////////////////////////////Load Settings File ///configger m_syscfSettings.Initialize(); @@ -115,8 +191,6 @@ int main(int argc, char* argv[]) return -1; } } - - bool bRes = QFile::copy("/root/DCTable.txt", "/home/data/Data/DCTable.txt"); if (!bRes) { @@ -124,12 +198,8 @@ int main(int argc, char* argv[]) return -2; } } - } //////////////////////////////////////////////////////////////////////////Check DCTable - - - ////////////////////////////////test only //MakeDCT m_test; //m_test.SetRunParams(m_struFSParam); @@ -138,7 +208,6 @@ int main(int argc, char* argv[]) //m_test.Initialize_Part(); //m_test.LoadTable(); ////////////////////////////////test only - m_ctrlGPS.SetContext(m_mgMainGrabber);//³õʼ»¯gps m_ctrlGPS.SetupMessagePipeline(); m_ctrlGPS.Initialize(m_struGPSInfo); @@ -153,13 +222,11 @@ int main(int argc, char* argv[]) m_mgMainGrabber.Initialize();//¿ªÊ¼¹¤×÷ - //m_ctrlGPS.SyncDateOnce(); + //m_ctrlGPS.VSlot_SkipSyncDateOnce(); + cout << "System Started..." << endl; /////// - - - //long long int a1;// 8 //long long b; // 8 //double c; // 8