fix & add

1、在界面上实现选择相机类型的功能;
2、创建了一个光谱仪操作的纯虚基类(ImagerOperationBase)并实现了大部分的操作,具体类型的光谱仪应继承此类并实现纯虚函数;
3、添加了 resonon 的 nir 320 相机,修改 resonon 的 pica l 相机的实现:继承 ImagerOperationBase;
4、重构类 QMotorDoubleSlider,提高其通用性,所有马达相关的 slider 都使用此类;
5、适配 resonon nir 320 显微镜使用的 2 轴线性平台,有些特殊的马达参数设置(setMotorParamMicroscope 函数)绑定了 nir 的相机类型参数;
6、修改:将线性平台的量程信息保存在cfg配置文件中,并修改配置文件读写类来读写此量程信息;
This commit is contained in:
tangchao0503
2024-12-11 13:50:03 +08:00
parent 9fa9fc8efb
commit 6469bff15d
24 changed files with 1544 additions and 788 deletions

View File

@ -155,7 +155,7 @@ bool Configfile::getAutoFocusRange(int& max, int& min)
return true;
}
bool Configfile::getXMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor)
bool Configfile::getXMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor, float& MaxRange)
{
const Setting& root = cfg.getRoot();
@ -170,6 +170,7 @@ bool Configfile::getXMotorParm(float& StepAnglemar, float& Lead, int& Subdivisio
if (!(x.lookupValue("StepAnglemar", StepAnglemar)
&& x.lookupValue("Lead", Lead) && x.lookupValue("SubdivisionMultiples", SubdivisionMultiples)
&& x.lookupValue("ScaleFactor", ScaleFactor)
&& x.lookupValue("MaxRange", MaxRange)
))
{
return false;
@ -184,7 +185,7 @@ bool Configfile::getXMotorParm(float& StepAnglemar, float& Lead, int& Subdivisio
return true;
}
bool Configfile::getYMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor)
bool Configfile::getYMotorParm(float& StepAnglemar, float& Lead, int& SubdivisionMultiples, float& ScaleFactor, float& MaxRange)
{
const Setting& root = cfg.getRoot();
@ -199,6 +200,7 @@ bool Configfile::getYMotorParm(float& StepAnglemar, float& Lead, int& Subdivisio
if (!(y.lookupValue("StepAnglemar", StepAnglemar)
&& y.lookupValue("Lead", Lead) && y.lookupValue("SubdivisionMultiples", SubdivisionMultiples)
&& y.lookupValue("ScaleFactor", ScaleFactor)
&& y.lookupValue("MaxRange", MaxRange)
))
{
return false;
@ -213,6 +215,43 @@ bool Configfile::getYMotorParm(float& StepAnglemar, float& Lead, int& Subdivisio
return true;
}
bool Configfile::setMaxRange(float maxRange, QString x_y)
{
const Setting& root = cfg.getRoot();
try
{
Setting& _maxRange = root["motionPlatform"][x_y.toStdString()]["MaxRange"];
_maxRange = maxRange;
writeConfig2File();
return true;
}
catch (const SettingNotFoundException& nfex)
{
cerr << "No 'MaxRange' setting in configuration file." << endl;
return false;
}
}
bool Configfile::writeConfig2File()
{
try
{
QList<QString> fileInfo = getFileInfo(QString::fromStdString(m_configfilePath));
bool ret = createDir(fileInfo[0]);
cfg.writeFile(m_configfilePath.c_str());
// cerr << "New configuration successfully written to: " << m_configfilePath.c_str() << endl;
}
catch (const FileIOException& fioex)
{
cerr << "I/O error while writing configuration file: " << m_configfilePath.c_str() << endl;
return false;
}
return true;
}
bool Configfile::getSN(string &SN)
{
try
@ -266,10 +305,12 @@ bool Configfile::createConfigFile()
Setting& x_Lead = x.add("Lead", Setting::TypeFloat) = 13.5;//<2F><><EFBFBD>̣<EFBFBD><CCA3><EFBFBD>λ<EFBFBD><CEBB>cm
Setting& x_SubdivisionMultiples = x.add("SubdivisionMultiples", Setting::TypeInt) = 128;//ϸ<>ֱ<EFBFBD><D6B1><EFBFBD>
Setting& x_ScaleFactor = x.add("ScaleFactor", Setting::TypeFloat) = 1.0;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Setting& x_MaxRange = x.add("MaxRange", Setting::TypeFloat) = 120.0;
Setting& y_StepAnglemar = y.add("StepAnglemar", Setting::TypeFloat) = 1.8;
Setting& y_Lead = y.add("Lead", Setting::TypeFloat) = 13.5;
Setting& y_SubdivisionMultiples = y.add("SubdivisionMultiples", Setting::TypeInt) = 128;
Setting& y_ScaleFactor = y.add("ScaleFactor", Setting::TypeFloat) = 0.2;
Setting& y_MaxRange = y.add("MaxRange", Setting::TypeFloat) = 120.0;
// Write out the new configuration.
try