mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-12-18 20:43:32 +08:00
Compare commits
1 Commits
renlixin-m
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| e8db9aa9fe |
5
.gitignore
vendored
5
.gitignore
vendored
@ -25,3 +25,8 @@
|
||||
/othersoft/TemperatureControler/project/cmake-build-debug-towersif/
|
||||
/DEB/
|
||||
/cmake-build-debug-nanopi/
|
||||
/othersoft/GPSLog/project/cmake-build-debug/
|
||||
/othersoft/GPSLog/project/cmake-build-debug-nanopi_sif/
|
||||
/othersoft/GPSLog/build/
|
||||
/othersoft/GPSLog/.idea/
|
||||
/othersoft/calibration_console/cmake-build-debug/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(TowerOptoSifAndSpectral)
|
||||
project(AirOptoSifAndSpectral)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
@ -26,17 +26,17 @@ include_directories("source/Uploader")
|
||||
|
||||
link_directories("source/OSIF/DLib")
|
||||
link_directories("/home/pi/SeaBrease/lib")
|
||||
add_executable( TowerOptoSifAndSpectral
|
||||
add_executable( AirOptoSifAndSpectral
|
||||
main.cpp
|
||||
${HDR_LIST}
|
||||
${SRC_LIST}
|
||||
)
|
||||
IF (WIN32)
|
||||
target_link_libraries(TowerOptoSifAndSpectral SeaBreeze)
|
||||
target_link_libraries(AirOptoSifAndSpectral SeaBreeze)
|
||||
ELSE ()
|
||||
target_link_libraries(TowerOptoSifAndSpectral seabreeze usb stdc++ m)
|
||||
target_link_libraries(AirOptoSifAndSpectral seabreeze usb stdc++ m)
|
||||
ENDIF ()
|
||||
qt5_use_modules(TowerOptoSifAndSpectral ${QT})
|
||||
set_target_properties(TowerOptoSifAndSpectral PROPERTIES AUTOMOC ON)
|
||||
qt5_use_modules(AirOptoSifAndSpectral ${QT})
|
||||
set_target_properties(AirOptoSifAndSpectral PROPERTIES AUTOMOC ON)
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
# exit 1
|
||||
#fi
|
||||
|
||||
VERSION=2.1.3
|
||||
VERSION=2.1.5
|
||||
sh install.sh
|
||||
|
||||
thispwd=$(pwd)
|
||||
@ -52,9 +52,9 @@ cp ../ChangeLog.md ./home/data/ChangeLog.md
|
||||
|
||||
#cd /home/pi/
|
||||
cd $thispwd
|
||||
sudo dpkg -b $DebDirectory TowerSif_V${VERSION}.deb
|
||||
sudo dpkg -b $DebDirectory AIRSif_V${VERSION}.deb
|
||||
mkdir -p DEB
|
||||
cp TowerSif_V${VERSION}.deb DEB/
|
||||
cp AIRSif_V${VERSION}.deb DEB/
|
||||
rm -r $DebDirectory
|
||||
|
||||
#sudo dpkg -r TowerSif
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<td style="width:33%">开始时间
|
||||
<input type="time" id="BeginTime" name="BeginTime" class="TextInput"></td>
|
||||
<td style="width:33%">时间间隔
|
||||
<input type="number" id="IntervalTime" name="IntervalTime" class="TextInput"></td>
|
||||
<input type="time" id="IntervalTime" name="IntervalTime" class="TextInput"></td>
|
||||
<td style="width:33%">停止时间
|
||||
<input type="time" id="EndTime" class="TextInput" name="EndTime"></td>
|
||||
</tr>
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<td width="100px">程序运行状态</td>
|
||||
<td width="50px" id="statid"></td>
|
||||
<td width="200px" id="statid"></td>
|
||||
<td ></td>
|
||||
<td><input type="button" value="重启" onclick="rebootclicked()"></td>
|
||||
</tr>
|
||||
@ -37,7 +37,7 @@
|
||||
<td style="width:33%">开始时间
|
||||
<input type="time" id="BeginTime" name="BeginTime" class="TextInput"></td>
|
||||
<td style="width:33%">时间间隔
|
||||
<input type="number" id="IntervalTime" name="IntervalTime" class="TextInput"></td>
|
||||
<input type="time" id="IntervalTime" name="IntervalTime" class="TextInput"></td>
|
||||
<td style="width:33%">停止时间
|
||||
<input type="time" id="EndTime" class="TextInput" name="EndTime"></td>
|
||||
</tr>
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
<?php
|
||||
|
||||
exec("ps -ef | grep TowerOptoSifAndSpectral | grep -v grep",$output,$return);
|
||||
exec("ps -ef | grep AirOptoSifAndSpectral | grep -v grep",$output,$return);
|
||||
exec("ps -ef | grep GPSLog | grep -v grep",$output1,$return1);
|
||||
//var_dump( $output);
|
||||
if ( count($output)>0)
|
||||
if ( count($output)>0&& count($output1)>0 )
|
||||
{
|
||||
echo '<div style="width: 40px;height: 20px;background: green"></div>';
|
||||
}else{
|
||||
echo '<div style="width: 40px;height: 20px;background: red"></div>';
|
||||
echo '<div style="width: 200px;height: 20px;background: green">READY</div>';
|
||||
}else if(count($output)==0&& count($output1)>0){
|
||||
echo '<div style="width: 200px;height: 20px;background: orange">SIF NOT WORK</div>';}
|
||||
else if(count($output)>0&& count($output1)==0){
|
||||
echo '<div style="width: 200px;height: 20px;background: yellow">GPS NOT WORK</div>';
|
||||
}
|
||||
else{
|
||||
echo '<div style="width: 200px;height: 20px;background: red">NO APPLOCATION WOKR</div>';
|
||||
}
|
||||
@ -2,7 +2,11 @@
|
||||
ignore_user_abort(true);
|
||||
set_time_limit(0);
|
||||
echo system("sudo killall Mywathdog.sh");
|
||||
echo system("sudo killall TowerOptoSifAndSpectral");
|
||||
echo system("sudo ./reboot.sh &");
|
||||
echo system("sudo killall Mywathdogtemp.sh");
|
||||
|
||||
echo system("sudo killall AirOptoSifAndSpectral");
|
||||
echo system("sudo killall GPSLog");
|
||||
|
||||
echo system("sudo sh ./reboot.sh &");
|
||||
echo "系统已重启";
|
||||
//var_dump($output);
|
||||
@ -1,3 +1,3 @@
|
||||
|
||||
sleep 10
|
||||
/root/Mywathdog.sh>>log.txt &
|
||||
|
||||
/root/Mywathdogtemp.sh &
|
||||
|
||||
4
main.cpp
4
main.cpp
@ -60,6 +60,8 @@ int main(int argc, char *argv[])
|
||||
iRet0 = system("gpio mode 1 out");
|
||||
iRet1 = system("gpio mode 4 out");
|
||||
iRet2 = system("gpio mode 5 out");
|
||||
system("gpio mode 13 input");
|
||||
system("gpio write 13 0");
|
||||
iRet3 = system("gpio write 1 1");//上电
|
||||
|
||||
qDebug() << "gpio 1;4;5; ready"<<" Ret:"<< iRet0<< iRet1<< iRet2<< endl;
|
||||
@ -128,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
m_pqUploaderThreadHolder->start();
|
||||
|
||||
m_mdgGrabber.Init_Self();
|
||||
m_sTimer.Preheating();
|
||||
//m_sTimer.Preheating();
|
||||
m_sTimer.SelfStart();
|
||||
//////////////////////////////////////////////////////////////////////////test
|
||||
// DataFileProcessor testdp;
|
||||
|
||||
28
othersoft/GPSLog/project/CMakeLists.txt
Normal file
28
othersoft/GPSLog/project/CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(GPSLog)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# Qt 5.12 需要手动指定 Qt 模块
|
||||
set(QT_MODULES Core SerialPort)
|
||||
|
||||
find_package(Qt5 COMPONENTS ${QT_MODULES} REQUIRED)
|
||||
|
||||
include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5SerialPort_INCLUDE_DIRS})
|
||||
include_directories("../src/Logger")
|
||||
|
||||
# Source files
|
||||
file(GLOB SOURCES "../src/*.cpp" "../src/*.h")
|
||||
|
||||
# Tell CMake to run moc when necessary
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
message(STATUS "SOURCES: ${SOURCES}")
|
||||
|
||||
add_executable(GPSLog ${SOURCES})
|
||||
|
||||
qt5_use_modules(GPSLog Core SerialPort)
|
||||
|
||||
target_link_libraries(GPSLog Qt5::Core Qt5::SerialPort)
|
||||
36
othersoft/GPSLog/src/DataLogger.cpp
Normal file
36
othersoft/GPSLog/src/DataLogger.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include "DataLogger.h"
|
||||
#include <QDebug>
|
||||
|
||||
DataLogger::DataLogger(const QString &filePath, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_filePath(filePath),
|
||||
m_file(filePath)
|
||||
{
|
||||
m_stream.setDevice(&m_file);
|
||||
}
|
||||
|
||||
bool DataLogger::openFile()
|
||||
{
|
||||
if (m_file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
|
||||
qDebug() << "Data log file opened: " << m_filePath;
|
||||
return true;
|
||||
} else {
|
||||
qDebug() << "Failed to open data log file: " << m_filePath << ", error: " << m_file.errorString();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DataLogger::closeFile()
|
||||
{
|
||||
if (m_file.isOpen()) {
|
||||
m_stream.flush();
|
||||
m_file.close();
|
||||
qDebug() << "Data log file closed: " << m_filePath;
|
||||
}
|
||||
}
|
||||
|
||||
void DataLogger::logData(const QString &computerTime, const QString &gpsTime, double latitude, double longitude, double altitude)
|
||||
{
|
||||
m_stream << computerTime << "," << gpsTime << "," << latitude << "," << longitude << "," << altitude << "\n";
|
||||
m_stream.flush();
|
||||
}
|
||||
25
othersoft/GPSLog/src/DataLogger.h
Normal file
25
othersoft/GPSLog/src/DataLogger.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef DATALOGGER_H
|
||||
#define DATALOGGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
class DataLogger : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DataLogger(const QString &filePath, QObject *parent = nullptr);
|
||||
|
||||
bool openFile();
|
||||
void closeFile();
|
||||
void logData(const QString &computerTime, const QString &gpsTime, double latitude, double longitude, double altitude);
|
||||
|
||||
private:
|
||||
QString m_filePath;
|
||||
QFile m_file;
|
||||
QTextStream m_stream;
|
||||
};
|
||||
|
||||
#endif // DATALOGGER_H
|
||||
105
othersoft/GPSLog/src/GPSDataParser.cpp
Normal file
105
othersoft/GPSLog/src/GPSDataParser.cpp
Normal file
@ -0,0 +1,105 @@
|
||||
#include "GPSDataParser.h"
|
||||
#include <QDebug>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
GPSDataParser::GPSDataParser(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_latitude(0.0),
|
||||
m_longitude(0.0),
|
||||
m_altitude(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
long timeshasrecive=0;
|
||||
float alttiude_last=0.0;
|
||||
void GPSDataParser::parse(const QByteArray &nmeaData)
|
||||
{
|
||||
if (timeshasrecive>=2000)timeshasrecive=0;
|
||||
timeshasrecive++;
|
||||
if (timeshasrecive<10)
|
||||
qDebug() << "Received NMEA data: " << nmeaData;
|
||||
|
||||
|
||||
QString nmeaString = QString::fromUtf8(nmeaData);
|
||||
QStringList nmeaParts = nmeaString.split(",");
|
||||
|
||||
// if (nmeaParts.size() < 11) {
|
||||
// qDebug() << "Invalid NMEA data: " << nmeaString;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Parse GPGGA sentence
|
||||
// qDebug() << " first " << nmeaParts[0];
|
||||
if (nmeaParts[0] == "$GPGGA"|| nmeaParts[0] == "$GNGGA") {
|
||||
// qDebug() << " GGA data: " << nmeaString;
|
||||
if (nmeaParts.size() < 10) {
|
||||
qDebug() << "Invalid GGA data: " << nmeaString;
|
||||
return;
|
||||
}
|
||||
QString utcTime = nmeaParts[1];
|
||||
|
||||
bool ok;
|
||||
double latitudeDegrees = nmeaParts[2].toDouble(&ok);
|
||||
if (!ok) return;
|
||||
char latitudeDirection = nmeaParts[3].at(0).toLatin1();
|
||||
|
||||
double longitudeDegrees = nmeaParts[4].toDouble(&ok);
|
||||
if (!ok) return;
|
||||
char longitudeDirection = nmeaParts[5].at(0).toLatin1();
|
||||
|
||||
double altitude = nmeaParts[9].toDouble(&ok);
|
||||
if (!ok) return;
|
||||
|
||||
double latitude = convertToDecimalDegrees(latitudeDegrees, latitudeDirection);
|
||||
double longitude = convertToDecimalDegrees(longitudeDegrees, longitudeDirection);
|
||||
//emit dataParsed(utcTime, latitude, longitude, altitude);
|
||||
alttiude_last=altitude;
|
||||
} else if (nmeaParts[0] == "$GPRMC"|| nmeaParts[0] == "$GNRMC") {
|
||||
|
||||
// qDebug() << "valid RMC data: " << nmeaString;
|
||||
if (nmeaParts.size() < 7) {
|
||||
qDebug() << "Invalid RMC data: " << nmeaString;
|
||||
return;
|
||||
}
|
||||
QString utcTime = nmeaParts[1];
|
||||
char status = nmeaParts[2].at(0).toLatin1();
|
||||
if (status == 'A') {
|
||||
|
||||
bool ok;
|
||||
double latitudeDegrees = nmeaParts[3].toDouble(&ok);
|
||||
if (!ok) return;
|
||||
char latitudeDirection = nmeaParts[4].at(0).toLatin1();
|
||||
|
||||
double longitudeDegrees = nmeaParts[5].toDouble(&ok);
|
||||
if (!ok) return;
|
||||
char longitudeDirection = nmeaParts[6].at(0).toLatin1();
|
||||
|
||||
double latitude = convertToDecimalDegrees(latitudeDegrees, latitudeDirection);
|
||||
double longitude = convertToDecimalDegrees(longitudeDegrees, longitudeDirection);
|
||||
double altitude = 0.0; // RMC doesn't have altitude
|
||||
emit dataParsed(utcTime, latitude, longitude, alttiude_last);
|
||||
// // 输出utc lat long alt
|
||||
// qDebug()<< "RMC Parsed Data - UTC Time:" << utcTime
|
||||
// << "Latitude:" << latitude
|
||||
// << "Longitude:" << longitude
|
||||
// << "Altitude:" << altitude;
|
||||
system("gpio mode 13 out");
|
||||
}
|
||||
} else {
|
||||
// qDebug() << "other NMEA data: " << nmeaString;
|
||||
}
|
||||
}
|
||||
double GPSDataParser::convertToDecimalDegrees(double degreesMinutes, char direction)
|
||||
{
|
||||
double degrees = int(degreesMinutes / 100);
|
||||
double minutes = degreesMinutes - (degrees * 100);
|
||||
double decimalDegrees = degrees + (minutes / 60);
|
||||
|
||||
if (direction == 'S' || direction == 'W') {
|
||||
decimalDegrees *= -1;
|
||||
}
|
||||
|
||||
return decimalDegrees;
|
||||
}
|
||||
36
othersoft/GPSLog/src/GPSDataParser.h
Normal file
36
othersoft/GPSLog/src/GPSDataParser.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef GPSDATAPARSER_H
|
||||
#define GPSDATAPARSER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
class GPSDataParser : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GPSDataParser(QObject *parent = nullptr);
|
||||
|
||||
void parse(const QByteArray &nmeaData);
|
||||
|
||||
signals:
|
||||
void dataParsed(const QString &gpsTime, double latitude, double longitude, double altitude);
|
||||
|
||||
|
||||
private:
|
||||
double convertToDecimalDegrees(double degreesMinutes, char direction);
|
||||
|
||||
private:
|
||||
QString m_utcTime;
|
||||
double m_latitude;
|
||||
double m_longitude;
|
||||
double m_altitude;
|
||||
|
||||
public:
|
||||
inline QString getUTCTime() const { return m_utcTime; }
|
||||
inline double getLatitude() const { return m_latitude; }
|
||||
inline double getLongitude() const { return m_longitude; }
|
||||
inline double getAltitude() const { return m_altitude; }
|
||||
};
|
||||
|
||||
#endif // GPSDATAPARSER_H
|
||||
94
othersoft/GPSLog/src/Logger/Logger.h
Normal file
94
othersoft/GPSLog/src/Logger/Logger.h
Normal file
@ -0,0 +1,94 @@
|
||||
//
|
||||
// Created by xin on 2021/8/17.
|
||||
//edit by zz.
|
||||
//fixed code page problem;added a new initialize function; --20211101
|
||||
#pragma once
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QDateTime>
|
||||
#include "qmutex.h"
|
||||
#include "QtMsgHandler"
|
||||
#include <iostream>
|
||||
#include <QDir>
|
||||
namespace QT_LOG
|
||||
{
|
||||
static int m_LogLevel = 1;
|
||||
static QString m_LogFile = QString("%1_GPS.log").arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmss"));
|
||||
QMutex m_LogMutex;
|
||||
|
||||
void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
if (type < m_LogLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString log_info;
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
log_info = QString("%1:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||
break;
|
||||
|
||||
case QtWarningMsg:
|
||||
log_info = QString("%1[Warning]:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||
break;
|
||||
|
||||
case QtCriticalMsg:
|
||||
log_info = QString("%1[Critical]:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||
break;
|
||||
|
||||
case QtFatalMsg:
|
||||
log_info = QString("%1[Fatal]:%2").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"),msg);
|
||||
abort();
|
||||
}
|
||||
|
||||
m_LogMutex.lock();
|
||||
|
||||
QFile outFile(m_LogFile);
|
||||
outFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
|
||||
QTextStream ts(&outFile);
|
||||
ts << log_info << endl;
|
||||
|
||||
std::cout<<log_info.toStdString()<<std::endl;
|
||||
|
||||
outFile.close();
|
||||
|
||||
m_LogMutex.unlock();
|
||||
}
|
||||
void logInit(QString logFile = "",int logLevel = 0)
|
||||
{
|
||||
|
||||
#ifndef _Debug
|
||||
if ((logLevel < 0) || (logLevel > 3))
|
||||
{
|
||||
m_LogLevel = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LogLevel = logLevel;
|
||||
}
|
||||
|
||||
if (!logFile.isEmpty())
|
||||
{
|
||||
m_LogFile = logFile+"/"+m_LogFile;
|
||||
}
|
||||
|
||||
qInstallMessageHandler(customMessageHandler);
|
||||
//qInstallMsgHandler(customMessageHandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
//added by IRIS_ZZ initialize from main
|
||||
void InitLogger(QString qstrDir)
|
||||
{
|
||||
QDir qdLogFolder;
|
||||
qdLogFolder.mkdir(qstrDir);
|
||||
qDebug() << QT_LOG::m_LogFile;
|
||||
QT_LOG::logInit(qstrDir);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
58
othersoft/GPSLog/src/SerialPortReader.cpp
Normal file
58
othersoft/GPSLog/src/SerialPortReader.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "SerialPortReader.h"
|
||||
|
||||
SerialPortReader::SerialPortReader(const QString &portName, int baudRate, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_portName(portName),
|
||||
m_baudRate(baudRate),
|
||||
m_serialPort(new QSerialPort(this))
|
||||
{
|
||||
m_serialPort->setPortName(m_portName);
|
||||
m_serialPort->setBaudRate(115200);
|
||||
|
||||
connect(m_serialPort, &QSerialPort::readyRead, this, &SerialPortReader::readData);
|
||||
}
|
||||
|
||||
SerialPortReader::~SerialPortReader()
|
||||
{
|
||||
closePort();
|
||||
}
|
||||
|
||||
bool SerialPortReader::openPort()
|
||||
{
|
||||
if (m_serialPort->open(QIODevice::ReadOnly)) {
|
||||
qDebug() << "Serial port opened: " << m_portName;
|
||||
return true;
|
||||
} else {
|
||||
qDebug() << "Failed to open serial port: " << m_portName << ", error: " << m_serialPort->errorString();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void SerialPortReader::closePort()
|
||||
{
|
||||
if (m_serialPort->isOpen()) {
|
||||
m_serialPort->close();
|
||||
qDebug() << "Serial port closed: " << m_portName;
|
||||
}
|
||||
}
|
||||
|
||||
void SerialPortReader::start()
|
||||
{
|
||||
if (!openPort()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void SerialPortReader::readData()
|
||||
{
|
||||
QByteArray newData = m_serialPort->readAll();
|
||||
m_buffer.append(newData);
|
||||
|
||||
int nmeaEndIndex = m_buffer.indexOf("\r\n");
|
||||
while (nmeaEndIndex != -1) {
|
||||
QByteArray nmeaData = m_buffer.left(nmeaEndIndex);
|
||||
m_buffer.remove(0, nmeaEndIndex + 2);
|
||||
nmeaEndIndex = m_buffer.indexOf("\r\n");
|
||||
emit dataReceived(nmeaData);
|
||||
}
|
||||
}
|
||||
35
othersoft/GPSLog/src/SerialPortReader.h
Normal file
35
othersoft/GPSLog/src/SerialPortReader.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef SERIALPORTREADER_H
|
||||
#define SERIALPORTREADER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QSerialPort>
|
||||
#include <QSerialPortInfo>
|
||||
#include <QDebug>
|
||||
|
||||
class SerialPortReader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SerialPortReader(const QString &portName, int baudRate, QObject *parent = nullptr);
|
||||
~SerialPortReader();
|
||||
|
||||
bool openPort();
|
||||
void closePort();
|
||||
|
||||
void start();
|
||||
|
||||
signals:
|
||||
void dataReceived(const QByteArray &data);
|
||||
|
||||
private slots:
|
||||
void readData();
|
||||
|
||||
private:
|
||||
QString m_portName;
|
||||
int m_baudRate;
|
||||
QSerialPort *m_serialPort;
|
||||
QByteArray m_buffer;
|
||||
};
|
||||
|
||||
#endif // SERIALPORTREADER_H
|
||||
62
othersoft/GPSLog/src/main.cpp
Normal file
62
othersoft/GPSLog/src/main.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QSerialPort>
|
||||
#include <QSerialPortInfo>
|
||||
|
||||
#include "SerialPortReader.h"
|
||||
#include "GPSDataParser.h"
|
||||
#include "DataLogger.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
system("gpio mode 13 input");
|
||||
QT_LOG::InitLogger("/home/data/Log/");
|
||||
|
||||
// 1. 查找可用的串口
|
||||
QString serialPortName;
|
||||
const auto serialPortInfos = QSerialPortInfo::availablePorts();
|
||||
if (!serialPortInfos.isEmpty()) {
|
||||
for (const QSerialPortInfo &serialPortInfo : serialPortInfos) {
|
||||
qDebug() << "Available serial port: " << serialPortInfo.portName();
|
||||
}
|
||||
// 默认使用第一个串口
|
||||
serialPortName = serialPortInfos.first().portName();
|
||||
} else {
|
||||
qDebug() << "No serial port found.";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 3. 创建 SerialPortReader, GPSDataParser, DataLogger
|
||||
SerialPortReader serialPortReader("/dev/ttyS2", 115200);
|
||||
GPSDataParser gpsDataParser;
|
||||
QDateTime datenow=QDateTime::currentDateTime();
|
||||
QString fileparenth=QString("/home/data/GPS_Data/%1").arg(datenow.toString("yyyyMMdd"));
|
||||
QString command=QString("mkdir -p %1").arg(fileparenth);
|
||||
system(command.toStdString().c_str());
|
||||
QString filePath = fileparenth+QString("/%1_gps.csv").arg( datenow.toString("yyyyMMdd_HHmmss"));
|
||||
DataLogger dataLogger(filePath);
|
||||
if (!dataLogger.openFile()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 4. 连接信号和槽
|
||||
QObject::connect(&serialPortReader, &SerialPortReader::dataReceived, &gpsDataParser, &GPSDataParser::parse);
|
||||
QObject::connect(&gpsDataParser, &GPSDataParser::dataParsed, [&](const QString &gpsTime, double latitude, double longitude, double altitude) {
|
||||
QString computerTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz");
|
||||
dataLogger.logData(computerTime, gpsTime, latitude, longitude, altitude);
|
||||
});
|
||||
|
||||
// 5. 启动串口读取
|
||||
serialPortReader.start();
|
||||
|
||||
// 6. 启动应用程序事件循环
|
||||
int result = a.exec();
|
||||
|
||||
// 7. 关闭文件
|
||||
dataLogger.closeFile();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -7,10 +7,24 @@ cmake ../../movingliner
|
||||
make -j4
|
||||
mkdir /home/pi/bin
|
||||
cp ./movingliner /home/pi/bin
|
||||
echo beging build GPSlog
|
||||
|
||||
cd ../
|
||||
sudo killall Mywathdogtemp.sh
|
||||
sudo killall GPSLog
|
||||
mkdir -p GPSlog
|
||||
cd GPSlog
|
||||
cmake ../../GPSLog/project/
|
||||
make -j4
|
||||
mkdir /home/pi/bin
|
||||
cp ./GPSLog /home/pi/bin
|
||||
|
||||
echo beging build shuttercali
|
||||
|
||||
cd ../
|
||||
|
||||
|
||||
|
||||
mkdir -p shuttercali
|
||||
cd shuttercali
|
||||
cmake ../../shuttercali/project/LocationCali
|
||||
@ -34,12 +48,13 @@ make -j4
|
||||
cp ./ocean_optics_calibration_console /home/pi/bin
|
||||
cd ../
|
||||
sudo killall Mywathdog.sh
|
||||
sudo killall TowerOptoSifAndSpectral
|
||||
sudo killall AirOptoSifAndSpectral
|
||||
|
||||
cd ../../
|
||||
cp -r ./html/* /var/www/html
|
||||
chmod +x /var/www/html/php/*.sh
|
||||
cd ./build
|
||||
cp TowerOptoSifAndSpectral /home/pi/bin
|
||||
cp AirOptoSifAndSpectral /home/pi/bin
|
||||
cd ../
|
||||
cp ./root/Mywathdog.sh /root
|
||||
cp ./root/start.sh /root
|
||||
|
||||
@ -5,17 +5,17 @@ do
|
||||
echo $time
|
||||
if [[ "$time" > "01:00:01" ]] && [[ "$time" < "22:30:00" ]]
|
||||
then
|
||||
ps -ef | grep "TowerOptoSifAndSpectral" | grep -v "grep"
|
||||
ps -ef | grep "AirOptoSifAndSpectral" | grep -v "grep"
|
||||
if [ "$?" -eq 1 ]
|
||||
then
|
||||
/home/pi/bin/TowerOptoSifAndSpectral &
|
||||
/home/pi/bin/AirOptoSifAndSpectral &
|
||||
echo "process has been restarted!" > /home/data/log.txt
|
||||
else
|
||||
echo "process already started!"
|
||||
sleep 60
|
||||
fi
|
||||
else
|
||||
pid=$(ps -ef | grep "TowerOptoSifAndSpectral" | grep -v "grep" | awk '{print $2}')
|
||||
pid=$(ps -ef | grep "AirOptoSifAndSpectral" | grep -v "grep" | awk '{print $2}')
|
||||
if [ -z "$pid" ]
|
||||
then
|
||||
sleep 60
|
||||
|
||||
@ -5,23 +5,23 @@ do
|
||||
echo $time
|
||||
if [[ "$time" > "01:00:01" ]] && [[ "$time" < "22:30:00" ]]
|
||||
then
|
||||
ps -ef | grep "TemperatureControler" | grep -v "grep"
|
||||
ps -ef | grep "GPSLog" | grep -v "grep"
|
||||
if [ "$?" -eq 1 ]
|
||||
then
|
||||
/home/pi/bin/TemperatureControler &
|
||||
/home/pi/bin/GPSLog &
|
||||
echo "process has been restarted!" > /home/data/log.txt
|
||||
else
|
||||
echo "process already started!"
|
||||
sleep 60
|
||||
fi
|
||||
else
|
||||
pid=$(ps -ef | grep "TemperatureControler" | grep -v "grep" | awk '{print $2}')
|
||||
pid=$(ps -ef | grep "GPSLog" | grep -v "grep" | awk '{print $2}')
|
||||
if [ -z "$pid" ]
|
||||
then
|
||||
sleep 60
|
||||
else
|
||||
echo "$?"
|
||||
echo "time to kill the task" > /home/data/log.txt
|
||||
echo "time to kill the task" > /home/data/gpslog.txt
|
||||
kill "$pid"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -8,5 +8,5 @@ chmod +x /root/Mywathdog.sh
|
||||
chmod +x /root/Mywathdogtemp.sh
|
||||
bash /root/Mywathdog.sh &
|
||||
bash /root/Mywathdogtemp.sh &
|
||||
/home/pi/bin/TemperatureControler > /root/templog.log &
|
||||
/home/pi/bin/AirOptoSifAndSpectral > /root/templog.log &
|
||||
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
#include "AbstractFSController.h"
|
||||
#include "ZZ_Math_HDRONLY.h"
|
||||
#include <math.h>
|
||||
void Delay_MSec(ZZ_U16 usMS)
|
||||
{
|
||||
QEventLoop qeLoop;
|
||||
QTimer::singleShot(usMS, &qeLoop, SLOT(quit()));
|
||||
qeLoop.exec();
|
||||
}
|
||||
CAbstractFSController::CAbstractFSController(QObject* parent /*= nullptr*/)
|
||||
{
|
||||
iFlagInit = 0;
|
||||
@ -13,6 +19,11 @@ CAbstractFSController::CAbstractFSController(QObject* parent /*= nullptr*/)
|
||||
m_qstrCalFilePath = "/home/data/Cal";
|
||||
|
||||
m_vecNonLinearCalP.clear();
|
||||
for (int i=0;i<10;i++) {
|
||||
m_taginfolast.ITtimeChange[i] =true;
|
||||
m_taginfolast.LastMAXValue[i] = 0;
|
||||
m_taginfolast.lastITTIME[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CAbstractFSController::~CAbstractFSController()
|
||||
@ -21,6 +32,7 @@ CAbstractFSController::~CAbstractFSController()
|
||||
{
|
||||
delete m_pFSCtrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int CAbstractFSController::SetRunParas(int iThreadID, FSInfo fsInfo)
|
||||
@ -135,8 +147,19 @@ int CAbstractFSController::GetDeviceAttr(DeviceAttribute &daAttr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CAbstractFSController::PerformAutoExposure()
|
||||
int CAbstractFSController::PerformAutoExposure(int position)
|
||||
{
|
||||
if (position!=0) {
|
||||
// m_taginfolast.ITtimeChange[position] = true;
|
||||
m_taginfolast.lastITTIME[position] = m_taginfolast.lastITTIME[0]*0.5 ;
|
||||
m_pFSCtrl->SetExposureTime(m_taginfolast.lastITTIME[position] );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID;
|
||||
using namespace ZZ_MATH;
|
||||
float fPredictedExposureTime;
|
||||
@ -153,7 +176,7 @@ int CAbstractFSController::PerformAutoExposure()
|
||||
bool bIsValueOverflow = false;
|
||||
bool bIsLastValueOverflow = false;
|
||||
|
||||
int iExposureTime = 0;
|
||||
int iExposureTime = 1000;
|
||||
float fTempExposureTime = 0;
|
||||
double fLastExposureTime = 0.1;
|
||||
int iRepeatCount = 0;
|
||||
@ -177,9 +200,9 @@ int CAbstractFSController::PerformAutoExposure()
|
||||
break;
|
||||
}
|
||||
//m_pFSCtrl->SetExposureTime(5000);
|
||||
m_pFSCtrl->GetExposureTime(iExposureTime);
|
||||
qDebug() << "Current ExpTime:" << iExposureTime << " Thread ID:" << m_iThreadID;
|
||||
//m_pFSCtrl->SetExposureTime(2500);
|
||||
// m_pFSCtrl->GetExposureTime(iExposureTime);
|
||||
// qDebug() << "Current ExpTime:" << iExposureTime << " Thread ID:" << m_iThreadID;
|
||||
m_pFSCtrl->SetExposureTime(iExposureTime);
|
||||
//fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||
fTempExposureTime = iExposureTime;
|
||||
|
||||
@ -270,7 +293,8 @@ int CAbstractFSController::PerformAutoExposure()
|
||||
// {
|
||||
// qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID;
|
||||
// }
|
||||
|
||||
m_taginfolast.ITtimeChange[position] = true;
|
||||
m_taginfolast.lastITTIME[position] = m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||
iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);
|
||||
if (iRes != 0)
|
||||
{
|
||||
@ -301,7 +325,8 @@ int CAbstractFSController::PerformAutoExposure()
|
||||
//{
|
||||
//qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to 30sec";
|
||||
//}
|
||||
|
||||
m_taginfolast.ITtimeChange[position] = true;
|
||||
m_taginfolast.lastITTIME[position] =m_daDeviceAttr.iMaxIntegrationTimeInMS - 1;
|
||||
iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMaxIntegrationTimeInMS - 1);
|
||||
if (iRes != 0)
|
||||
{
|
||||
@ -315,7 +340,8 @@ int CAbstractFSController::PerformAutoExposure()
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
m_taginfolast.ITtimeChange[position] = true;
|
||||
m_taginfolast.lastITTIME[position] =(int)iExposureTime;
|
||||
iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime);
|
||||
if (iRes != 0)
|
||||
{
|
||||
@ -335,11 +361,69 @@ int CAbstractFSController::PerformAutoExposure()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CAbstractFSController::TakeDarkFrame()
|
||||
{
|
||||
qDebug() << "Starting TakeDarkFrame" << " Thread ID:" << m_iThreadID;
|
||||
int CAbstractFSController::ComputExposure(int position) {
|
||||
if (position==0) {
|
||||
|
||||
m_vecDataFrameDark.push_back(TakeOneFrame());
|
||||
|
||||
int lastittime=m_taginfolast.lastITTIME[position];
|
||||
int lastmaxvalue=m_taginfolast.LastMAXValue[position];
|
||||
|
||||
int maxallowvalue=m_fsInfo.lDepth * m_fsInfo.fMaxFactor;
|
||||
int minallowvalue=m_fsInfo.lDepth * m_fsInfo.fMinFactor;
|
||||
if (lastmaxvalue>maxallowvalue) {
|
||||
if (lastmaxvalue>=m_fsInfo.lDepth) {
|
||||
lastittime=lastittime/2;
|
||||
|
||||
}else {
|
||||
lastittime=lastittime*(maxallowvalue*1.0/lastmaxvalue)*0.95;
|
||||
}
|
||||
|
||||
m_taginfolast.ITtimeChange[position]=true;
|
||||
m_taginfolast.lastITTIME[position]=lastittime;
|
||||
m_pFSCtrl->SetExposureTime(lastittime);
|
||||
qDebug()<< "Set exposure time for position"<<position<<" to "<<lastittime;
|
||||
return lastittime;
|
||||
|
||||
}
|
||||
if (lastmaxvalue<minallowvalue) {
|
||||
lastittime=lastittime*(minallowvalue*1.0/lastmaxvalue)*1.05;
|
||||
if (lastittime>=60000) {
|
||||
lastittime=60000;
|
||||
}
|
||||
m_taginfolast.ITtimeChange[position]=true;
|
||||
m_taginfolast.lastITTIME[position]=lastittime;
|
||||
m_pFSCtrl->SetExposureTime(lastittime);
|
||||
qDebug()<< "Set exposure time for position"<<position<<" to "<<lastittime;
|
||||
return lastittime;
|
||||
}
|
||||
m_taginfolast.ITtimeChange[position]=false;
|
||||
m_pFSCtrl->SetExposureTime(lastittime);
|
||||
qDebug()<< "Set exposure time for position"<<position<<" to "<<lastittime;
|
||||
return lastittime;
|
||||
}
|
||||
int lasttimeindev=0;
|
||||
m_pFSCtrl->GetExposureTime(lasttimeindev);
|
||||
|
||||
m_pFSCtrl->SetExposureTime(m_taginfolast.lastITTIME[0]*0.5);
|
||||
if (lasttimeindev!=m_taginfolast.lastITTIME[0]*0.5) {
|
||||
Delay_MSec(lasttimeindev);
|
||||
}
|
||||
qDebug()<< "Set exposure time for position"<<position<<" to "<<m_taginfolast.lastITTIME[0]*0.5;
|
||||
return m_taginfolast.lastITTIME[0]*0.5;
|
||||
|
||||
}
|
||||
|
||||
int CAbstractFSController::TakeDarkFrame(int position)
|
||||
{
|
||||
int shuttertime = 0;
|
||||
m_pFSCtrl->GetExposureTime(shuttertime);
|
||||
qDebug() << "Starting TakeDarkFrame" << " position ID:" << position<<" ITtime:"<<shuttertime<<"\n";
|
||||
if (m_taginfolast.ITtimeChange[0]) {
|
||||
m_taginfolast.LastDarkframe[position]=TakeOneFrame();
|
||||
}
|
||||
|
||||
|
||||
m_vecDataFrameDark.push_back(m_taginfolast.LastDarkframe[position]);
|
||||
|
||||
|
||||
qDebug() << "Stop TakeDarkFrame" << " Thread ID:" << m_iThreadID;
|
||||
@ -347,13 +431,77 @@ int CAbstractFSController::TakeDarkFrame()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CAbstractFSController::TakeSignalFrame()
|
||||
|
||||
int CAbstractFSController::ComputeMaxValue(DataFrame Data) {
|
||||
ZZ_S32 *pData = Data.lData;
|
||||
int number = 4096;
|
||||
int maxvalue=0;
|
||||
for (int i=0;i<number-1;i++) {
|
||||
if (pData[i]>maxvalue) {
|
||||
maxvalue=pData[i];
|
||||
}
|
||||
}
|
||||
return maxvalue;
|
||||
|
||||
// if (number <= 10) {
|
||||
// // 如果数据量小,直接排序计算
|
||||
// int sum = 0;
|
||||
// for (int i = 0; i < number; i++) {
|
||||
// sum += pData[i];
|
||||
// }
|
||||
// return number > 0 ? sum / number : 0;
|
||||
// }
|
||||
//
|
||||
// // 复制数据(或者直接操作原数组如果允许修改)
|
||||
// std::vector<int> temp(pData, pData + number);
|
||||
//
|
||||
// // 使用nth_element找到第10大的元素
|
||||
// std::nth_element(temp.begin(), temp.begin() + 9, temp.end(), std::greater<int>());
|
||||
//
|
||||
// // 计算前10个最大值的平均
|
||||
// int sum = 0;
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// sum += temp[i];
|
||||
// }
|
||||
//
|
||||
// return sum / 10;
|
||||
|
||||
|
||||
|
||||
|
||||
// int maxvalue[10]={0};
|
||||
// ZZ_S32 *pData=Data.lData;
|
||||
// int number=4096;
|
||||
// //获取pdata中最大的10个值
|
||||
// for (int i=0;i<number;i++) {
|
||||
// int val=pData[i];
|
||||
// for (int j=0;j<10;j++) {
|
||||
// if (val>maxvalue[j]) {
|
||||
// //插入到maxvalue中
|
||||
// for (int k=9;k>j;k--) {
|
||||
// maxvalue[k]=maxvalue[k-1];
|
||||
// }
|
||||
// maxvalue[j]=val;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
int CAbstractFSController::TakeSignalFrame(int position)
|
||||
{
|
||||
qDebug() << "Starting TakeSignal" << " Thread ID:" << m_iThreadID;
|
||||
int shuttertime = 0;
|
||||
m_pFSCtrl->GetExposureTime(shuttertime);
|
||||
qDebug() << "Starting TakeSignal" << " position" << position<<" ITtime:"<<shuttertime<<"\n";
|
||||
|
||||
m_vecDataFrameSignal.push_back(TakeOneFrame());
|
||||
|
||||
// todo: compute max ten value 计算前10个值平均值
|
||||
m_taginfolast.LastMAXValue[position]=ComputeMaxValue(m_vecDataFrameSignal.at(m_vecDataFrameSignal.size()-1));
|
||||
if (m_taginfolast.LastMAXValue[position]>=65535) {
|
||||
m_vecDataFrameSignal.at(m_vecDataFrameSignal.size()-1).bIsValid=false;
|
||||
}
|
||||
qDebug() << "Stop TakeSignal" << " Thread ID:" << m_iThreadID;
|
||||
qDebug()<< "Max 10 Average Value:" << m_taginfolast.LastMAXValue[position] << " Thread ID:" << m_iThreadID;
|
||||
//emit SignalAcqFinished(m_iThreadID, 1);
|
||||
return 0;
|
||||
}
|
||||
@ -417,6 +565,8 @@ DataFrame CAbstractFSController::TakeOneFrame()
|
||||
// return dfTemp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CAbstractFSController::SaveDataFile()
|
||||
{
|
||||
return 0;
|
||||
@ -460,7 +610,7 @@ int CAbstractFSController::LoadQEProLinearCalibrationFile()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CAbstractFSController::StartAcquisitionSignal()
|
||||
int CAbstractFSController::StartAcquisitionSignal(int position)
|
||||
{
|
||||
//
|
||||
qDebug() << "Starting acq Signal" << " Thread ID:" << m_iThreadID;
|
||||
@ -471,18 +621,24 @@ int CAbstractFSController::StartAcquisitionSignal()
|
||||
// m_pFSCtrl->GetExposureTime(iii);
|
||||
// m_pFSCtrl->SingleShot(struDF);
|
||||
|
||||
PerformAutoExposure();
|
||||
TakeSignalFrame();
|
||||
if (m_taginfolast.lastITTIME[position]==0) {
|
||||
PerformAutoExposure(position);
|
||||
}else {
|
||||
ComputExposure(position);
|
||||
}
|
||||
|
||||
|
||||
TakeSignalFrame(position);
|
||||
|
||||
qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID;
|
||||
emit SignalAcqFinished_Signal(m_iThreadID, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CAbstractFSController::StartAcquisitionDark()
|
||||
int CAbstractFSController::StartAcquisitionDark(int position)
|
||||
{
|
||||
qDebug() << "Starting acq Dark" << " Thread ID:" << m_iThreadID;
|
||||
TakeDarkFrame();
|
||||
TakeDarkFrame(position);
|
||||
qDebug() << "Stop acq Dark"<< " Thread ID:" << m_iThreadID;
|
||||
emit SignalAcqFinished_Dark(m_iThreadID, 1);
|
||||
|
||||
|
||||
@ -15,6 +15,15 @@ typedef struct tagFSInfo
|
||||
float fMaxFactor;
|
||||
}FSInfo;
|
||||
|
||||
struct tagINFOOFLOST {
|
||||
int LastMAXValue[10];
|
||||
int lastITTIME[10];
|
||||
bool ITtimeChange[10];
|
||||
DataFrame LastDarkframe[10];
|
||||
|
||||
};
|
||||
|
||||
|
||||
class CAbstractFSController :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -34,6 +43,8 @@ public:
|
||||
//sync info
|
||||
virtual int GetDeviceAttr(DeviceAttribute &daAttr);
|
||||
//DataFrame GetLastDataFrame();
|
||||
tagINFOOFLOST m_taginfolast;
|
||||
int positionnow=0;
|
||||
|
||||
private:
|
||||
CIrisFSBase *m_pFSCtrl;
|
||||
@ -48,17 +59,19 @@ private:
|
||||
QString m_qstrCalFilePath;
|
||||
std::vector<double> m_vecNonLinearCalP;
|
||||
private:
|
||||
int PerformAutoExposure();
|
||||
int TakeDarkFrame();
|
||||
int TakeSignalFrame();
|
||||
int PerformAutoExposure(int position);
|
||||
int ComputExposure(int position);
|
||||
int TakeDarkFrame(int position);
|
||||
int TakeSignalFrame(int position);
|
||||
DataFrame TakeOneFrame();
|
||||
int ComputeMaxValue(DataFrame Data);
|
||||
int SaveDataFile();
|
||||
|
||||
//QE NLC
|
||||
int LoadQEProLinearCalibrationFile();
|
||||
public slots:
|
||||
virtual int StartAcquisitionSignal();
|
||||
virtual int StartAcquisitionDark();
|
||||
virtual int StartAcquisitionSignal(int position);
|
||||
virtual int StartAcquisitionDark(int position);
|
||||
virtual int StopAcquisition();
|
||||
virtual int ClearBuffer();
|
||||
virtual int GetBuffer(std::vector<DataFrame> &pvecDataFrameDark, std::vector<DataFrame> &pvecDataFrameSignal);
|
||||
|
||||
@ -467,7 +467,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
|
||||
if (m_iFlagIsCapturing)
|
||||
{
|
||||
qDebug() << "Fatal Warning.Last capture not finished.New acquisition will not start";
|
||||
// qDebug() << "Fatal Warning.Last capture not finished.New acquisition will not start";
|
||||
return 1000;
|
||||
}
|
||||
m_iFlagIsCapturing = 1;
|
||||
@ -521,7 +521,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
qDebug() << qstrCMD_A;
|
||||
qDebug() << qstrCMD_B;
|
||||
|
||||
Delay_MSec(500);
|
||||
Delay_MSec(200);
|
||||
}
|
||||
else if (/*i==1*/i%2==1)
|
||||
{
|
||||
@ -537,7 +537,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
qDebug() << qstrCMD_A;
|
||||
qDebug() << qstrCMD_B;
|
||||
|
||||
Delay_MSec(500);
|
||||
Delay_MSec(200);
|
||||
}
|
||||
|
||||
|
||||
@ -545,6 +545,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
}
|
||||
else
|
||||
{
|
||||
//线性马达
|
||||
qDebug() << "Start ILMES_MoveToPos:" << i + 1;
|
||||
if (i == 0)
|
||||
{
|
||||
@ -563,10 +564,10 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
// m_struAcqPosSetting.iPosition[i + 1];
|
||||
m_iFlagIsCapturing_Signal = 1;
|
||||
|
||||
emit SignalStartGrabOnce_Signal();
|
||||
emit SignalStartGrabOnce_Signal(i);
|
||||
while (m_iFlagIsCapturing_Signal)
|
||||
{
|
||||
Delay_MSec(1000);
|
||||
Delay_MSec(100);
|
||||
}
|
||||
|
||||
|
||||
@ -586,6 +587,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
|
||||
qDebug() << qstrCMD_A;
|
||||
qDebug() << qstrCMD_B;
|
||||
Delay_MSec(200);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -598,10 +600,10 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
//m_struAcqPosSetting.iPosition[0];
|
||||
m_iFlagIsCapturing_Dark = 1;
|
||||
// todo : 机载时是否有实时采集暗电流
|
||||
emit SignalStartGrabOnce_Dark();
|
||||
emit SignalStartGrabOnce_Dark(i);
|
||||
while (m_iFlagIsCapturing_Dark)
|
||||
{
|
||||
Delay_MSec(1000);
|
||||
Delay_MSec(100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -632,6 +634,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
for (size_t j=0;j< vecDark.size();j++)
|
||||
{
|
||||
SubDataFrame(vecSignal[j], vecDark[j], m_struDeviceContext.usPixels[i]);
|
||||
vecDark[j].bIsValid=vecSignal[j].bIsValid;
|
||||
}
|
||||
vecData.push_back(vecSignal);
|
||||
if (savedarkfile) {
|
||||
@ -658,7 +661,9 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
m_pdfpSaver->WriteDarkDataFile();
|
||||
}
|
||||
}
|
||||
|
||||
system("gpio write 13 1");
|
||||
Delay_MSec(100);
|
||||
system("gpio write 13 0");
|
||||
m_iFlagIsCapturing = 0;
|
||||
|
||||
// qDebug() << "-------------------------------------------busy" << QTime::currentTime().toString();
|
||||
|
||||
@ -89,8 +89,8 @@ public slots:
|
||||
int GrabOnceFinished();
|
||||
|
||||
signals:
|
||||
void SignalStartGrabOnce_Signal();
|
||||
void SignalStartGrabOnce_Dark();
|
||||
void SignalStartGrabOnce_Signal(int position);
|
||||
void SignalStartGrabOnce_Dark(int position);
|
||||
|
||||
void SignalGrabOnceFinished_Signal();
|
||||
void SignalGrabOnceFinished_Dark();
|
||||
|
||||
@ -54,10 +54,10 @@ void Scheduler::StartAsPlanned()
|
||||
}
|
||||
|
||||
int iIntervalInMS = m_struAcqTime.qtInterval.hour() * 3600 * 1000 + m_struAcqTime.qtInterval.minute() * 60 * 1000 + m_struAcqTime.qtInterval.second() * 1000;
|
||||
|
||||
//iIntervalInMS =1000;
|
||||
m_GrabTimer->start(iIntervalInMS);
|
||||
|
||||
QThread::msleep(5000);
|
||||
QThread::msleep(1000);
|
||||
qDebug() << "it's time to start work.";
|
||||
emit SignalGrabOnce();
|
||||
//this->OnTimeCounter();
|
||||
@ -74,7 +74,7 @@ int Scheduler::OnTimeCounter()
|
||||
|
||||
}
|
||||
|
||||
qDebug() << "it's time to work...work work.";
|
||||
// qDebug() << "it's time to work...work work.";
|
||||
emit SignalGrabOnce();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -728,6 +728,7 @@ int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
||||
//return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -275,7 +275,9 @@ bool DataFileProcessor::WriteData(QString path)
|
||||
qstrTemp = QString("_P%1").arg(j + 1);
|
||||
qfData.write(qstrTemp.toLatin1());
|
||||
qfData.write(",");
|
||||
if ((m_vecData[i][j].fTemperature < 5) /*&& (m_vecData[i][j].fTemperature> -5)*/)
|
||||
// if ((m_vecData[i][j].fTemperature < 5) /*&& (m_vecData[i][j].fTemperature> -5)*/)
|
||||
if (m_vecDarkData[i][j].bIsValid)
|
||||
|
||||
{
|
||||
qfData.write("valid");
|
||||
}
|
||||
@ -327,7 +329,8 @@ bool DataFileProcessor::WriteDarkData(QString path)
|
||||
qstrTemp = QString("_P%1").arg(j + 1);
|
||||
qfData.write(qstrTemp.toLatin1());
|
||||
qfData.write(",");
|
||||
if ((m_vecDarkData[i][j].fTemperature < 5) /*&& (m_vecDarkData[i][j].fTemperature> -5)*/)
|
||||
// if ((m_vecDarkData[i][j].fTemperature < 5&&m_vecDarkData[i][j].bIsValid) /*&& (m_vecDarkData[i][j].fTemperature> -5)*/)
|
||||
if (m_vecDarkData[i][j].bIsValid)
|
||||
{
|
||||
qfData.write("valid");
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ namespace ZZ_MISCDEF
|
||||
ZZ_S32 lData[4096] = {0};
|
||||
float fTemperature = 0;
|
||||
double dTimes = 0;
|
||||
bool bIsValid = true;
|
||||
}DataFrame;
|
||||
|
||||
|
||||
|
||||
@ -235,11 +235,11 @@
|
||||
{
|
||||
qstrTemp = "0" + qstrTemp;
|
||||
}
|
||||
m_struAcqTime.qtInterval = QTime::fromString(qstrTemp, "mm");
|
||||
m_struAcqTime.qtInterval = QTime::fromString(qstrTemp, "mm:ss");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_struAcqTime.qtInterval = QTime::fromString(m_qjoJObj.value("IntervalTime").toString(), "mm");
|
||||
m_struAcqTime.qtInterval = QTime::fromString(m_qjoJObj.value("IntervalTime").toString(), "mm:ss");
|
||||
}
|
||||
if (!m_struAcqTime.qtInterval.isValid())
|
||||
{
|
||||
|
||||
@ -117,6 +117,7 @@ int CMainDataUploader::Initialize()
|
||||
|
||||
int CMainDataUploader::SlotPushOneDataFrame()
|
||||
{
|
||||
return 0;
|
||||
Calibration();
|
||||
UploadData();
|
||||
m_vecData.clear();
|
||||
|
||||
Reference in New Issue
Block a user