mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 11:29:43 +08:00
添加了位置定标程序 及位置移动相关程序源码
This commit is contained in:
52
othersoft/movingliner/main.cpp
Normal file
52
othersoft/movingliner/main.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include<VSMD12XControl.h>
|
||||
#include "qtextstream.h"
|
||||
QTextStream cout1(stdout, QIODevice::WriteOnly);
|
||||
void logout(QString str){
|
||||
std::cout<<str.toStdString()<<"<br>";
|
||||
std::fflush(stdout);
|
||||
}
|
||||
int main(int argc, char *argv[]) {
|
||||
int aaa=1000;
|
||||
QString str(argv[1]);
|
||||
QCoreApplication a(argc, argv);
|
||||
CVSMD12XControl Motercontrol;
|
||||
QString m_qstrDeviceConfigFilePath;
|
||||
// cout1<<"adfasdfsadfsd"<<flush;
|
||||
cout1<<"Your position number is "<<str<<"<br>"<<flush;
|
||||
#ifdef WIN32
|
||||
m_qstrDeviceConfigFilePath = ("D:\\03MyGit\\linux\\movingliner\\DeviceSettings.ini");
|
||||
#else
|
||||
m_qstrDeviceConfigFilePath = ("/home/data/Setting/DeviceSettings.ini");
|
||||
#endif
|
||||
|
||||
QSettings *m_qsDeviceConfig;
|
||||
m_qsDeviceConfig = new QSettings(m_qstrDeviceConfigFilePath, QSettings::IniFormat);
|
||||
long positon =m_qsDeviceConfig->value("LINEAR SHUTTER/Position"+str).toLongLong();
|
||||
if (positon==0)
|
||||
{
|
||||
logout("<b style=\"color:red\">Can not Find the position<\/b>");
|
||||
return 0;
|
||||
}
|
||||
cout1<<"Find Configfile in "<<m_qstrDeviceConfigFilePath<<" <br> The Port of Motor is "<<m_qsDeviceConfig->value("LINEAR SHUTTER/Port").toString()<<"<br>"<<flush;
|
||||
cout1<<"Position Find Value is "<<m_qsDeviceConfig->value("LINEAR SHUTTER/Position"+str).toLongLong()<<"<br>"<<flush;
|
||||
cout1<<"Configing The Motor <br>"<<flush;
|
||||
// m_qsDeviceConfig->value("LINEAR SHUTTER/Port").toString()
|
||||
Motercontrol.ILMES_InitializeComm(m_qsDeviceConfig->value("LINEAR SHUTTER/Port").toString());
|
||||
ControllerParams cpTest;
|
||||
Motercontrol.ILMES_InitializeParams(cpTest);
|
||||
|
||||
|
||||
|
||||
|
||||
logout("Moving to Zero");
|
||||
Motercontrol.StartBackZero();
|
||||
//std::cout<<"beging to move position";
|
||||
logout("Moving to The Position");
|
||||
Motercontrol.MoveTo(positon);
|
||||
|
||||
logout("<b style=\"color:green\">Finish the Task!!!<\/b> <br><b>Thanks For Using<\/b>");
|
||||
return 0;
|
||||
// return QCoreApplication::exec();
|
||||
}
|
Reference in New Issue
Block a user