M350b版本

This commit is contained in:
xin
2026-01-08 16:00:08 +08:00
parent 7396728ea7
commit a76d4b77e9
213 changed files with 8883 additions and 7196579 deletions

View File

@ -27,8 +27,9 @@ int CMainAcqThread::SetupContext()
{
m_ctrlConfigParser.SetFilePath("/home/data/Settings/MainSettings.ini");
m_ctrlConfigParser.GetParams(m_struMiscCtrls,m_struM300RTKSs,m_struSensorPort);
m_ctrlVehicle.Initialize();
m_ctrlVehicle.SetupEnvironment();
m_ctrlVehicle.SetupEnvironment_M300RTK();
#ifdef ZZ_FLAG_TEST
qDebug() << m_struSensorPort.qstrGasSensorPort;
qDebug() << m_struSensorPort.qstrWindSensorPort;
@ -37,7 +38,7 @@ int CMainAcqThread::SetupContext()
qDebug() << m_struM300RTKSs.qstrM300RTKWidgetFilePath;
#endif
// m_ctrlVehicle.SetupEnvironment_M300RTK();
m_ctrlVehicle.SetupEnvironment();
//m_ctrlVehicle.SetupEnvironment();
SetupMessagePipe();
return 0;
}
@ -49,7 +50,7 @@ int CMainAcqThread::StartUp()
system("sudo gpio write 7 0");
// m_ctrlVehicle.StartupPSDK_M300RTK();
m_ctrlVehicle.StartupPSDK_M350RTK();
m_ctrlVehicle.StartupPSDK_M300RTK();
QString qstrMessage = "Initializing sensors,Please wait...";
emit Signal_UpdateVehicleMessage(qstrMessage);
@ -83,6 +84,8 @@ int CMainAcqThread::StartUp()
int CMainAcqThread::SetupMessagePipe()
{
connect(&m_ctrlVehicle, &VehicleController::Signal_StartCapture, this, &CMainAcqThread::Slot_StartCapture);
connect(&m_ctrlVehicle.m_clsWidget,&ZZ_Widget_M300RTK::SendCommand,this,&CMainAcqThread::GetCommand);
connect(this, &CMainAcqThread::SendCommand, &m_ctrlVehicle.m_clsWidget, &ZZ_Widget_M300RTK::BackCommand);
connect(&m_ctrlVehicle, &VehicleController::Signal_StopCapture, this, &CMainAcqThread::Slot_StopCapture);
connect(this, &CMainAcqThread::Signal_UpdateVehicleMessage, &m_ctrlVehicle, &VehicleController::Signal_UpdateVehicleMessage);
@ -196,6 +199,7 @@ int CMainAcqThread::GetData()
float fSpeed=-1, fAngle=-1,fWindTemp=-1;
m_ctrlWindSensor.GetSA_NChk(fSpeed,fAngle, fWindTemp);
m_struUASDataFrame.fWindDirection = fAngle;
m_struUASDataFrame.fWindSpeed = fSpeed;
m_struUASDataFrame.fWindTemperature = fWindTemp;
@ -203,6 +207,8 @@ int CMainAcqThread::GetData()
m_ctrlVehicle.GetOneDataFrame(m_struM300RTKDataFrame);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
int CMainAcqThread::OnTimerCapture()
{
#ifdef ZZ_FLAG_TEST
@ -281,3 +287,94 @@ int CMainAcqThread::Slot_StopCapture()
return 0;
}
void CMainAcqThread::GetCommand(QString Worker, QString Command) {
// 用qDebug打印接收到的命令
qDebug()<<"Received Command - Worker:" << Worker << ", Command:" << Command;
int waitetime=10;
qDebug()<<"GetCommand Worker:"<<Worker<<" Command:"<<Command;
if (Worker=="WDA") {
//#分割字符comman
QStringList arc=Command.split("#");
if (arc[0]=="StartCalibrate") {
if (arc.length()<2) {
emit SendCommand("WDA","Finish");
return;
}
m_ctrlWindSensor.CalibrateWDA(arc[1].toDouble());
emit SendCommand("WDA","Finish");
}
}
else if (Worker == "GAS") {
QStringList arc = Command.split("#");
qDebug()<<"arc is"<<arc;
if (arc[0] == "ZeroCalibrate") {
if (arc.length() < 2) {
emit SendCommand("GAS", "Finish");
// system("sudo gpio write 7 0");
return;
}
if (arc[1]=="Air") {
// system("sudo gpio write 7 1");
qDebug()<<"Start Gas Motor now";
QThread::sleep(waitetime);
m_ctrlGasSensor.ZeroCalibration_Air();
QThread::sleep(waitetime);
emit SendCommand("GAS", "Finish");
// system("sudo gpio write 7 0");
qDebug()<<"Stop Gas Motor now";
}
else if (arc[1] == "N2") {
// system("sudo gpio write 7 1");
qDebug()<<"Start Gas Motor now";
QThread::sleep(waitetime);
m_ctrlGasSensor.ZeroCalibration_N2();
QThread::sleep(waitetime);
emit SendCommand("GAS", "Finish");
// system("sudo gpio write 7 0");
qDebug()<<"Stop Gas Motor now";
}
else {
emit SendCommand("GAS", "Finish");
}
}
else if (arc[0] == "SpanCalibrate") {
if (arc.size()<3) {
emit SendCommand("GAS", "Finish");
return;
}
char cChannel=0;
if (arc[1]=="CO2") {
cChannel=0x03;
} else if(arc[1]=="H2O") {
cChannel=0x02;
}
else {
emit SendCommand("GAS", "Finish");
return;
}
unsigned int uiPPM=arc[2].toUInt();
// system("sudo gpio write 7 1");
qDebug()<<"Start Gas Motor now";
QThread::sleep(waitetime);
m_ctrlGasSensor.SpanCalibration(cChannel,uiPPM);
QThread::sleep(waitetime);
emit SendCommand("GAS", "Finish");
// system("sudo gpio write 7 0");
qDebug()<<"Stop Gas Motor now";
}
}
}