自动调焦bug修复:自动调焦完成后,移动到最佳位置;
This commit is contained in:
tangchao0503
2026-07-16 16:09:23 +08:00
parent a49f416551
commit 245fc7f4ef

View File

@ -498,19 +498,25 @@ void focusWindow::onAutoFocusFinished()
void focusWindow::moveAfterAutoFocus(int motorID, double location) void focusWindow::moveAfterAutoFocus(int motorID, double location)
{ {
//QObject* obj = sender();
//if (obj == m_multiAxisController)
//{
// qDebug() << "sender is m_multiAxisController.";
//}
if (!m_isMoveAfterAutoFocus) if (!m_isMoveAfterAutoFocus)
{ {
//std::cout << "focusWindow::moveAfterAutoFocus" << std::endl;
return; return;
} }
std::cout << "\n已经到达位置:" << location << std::endl; std::cout << "\n已经到达位置:" << location << std::endl;
//移动马达到最佳位置
emit move2LocSignal(0, (double)m_goodPos, m_dSpeed, 1000);
double tmp = abs(location - m_goodPos) / m_goodPos * 100; double tmp = abs(location - m_goodPos) / m_goodPos * 100;
if (tmp<5) if (tmp < 5)
{ {
m_isMoveAfterAutoFocus = false;
if (!m_isAutoFocusSuccess) if (!m_isAutoFocusSuccess)
{ {
QMessageBox msgBox; QMessageBox msgBox;
@ -523,7 +529,11 @@ void focusWindow::moveAfterAutoFocus(int motorID, double location)
msgBox.setText(QString::fromLocal8Bit("自动调焦成功!")); msgBox.setText(QString::fromLocal8Bit("自动调焦成功!"));
msgBox.exec(); msgBox.exec();
} }
m_isMoveAfterAutoFocus = false; }
else
{
//移动马达到最佳位置
emit move2LocSignal(0, (double)m_goodPos, m_dSpeed, 1000);
} }
} }