Files
HPPA/HPPA/QMotorDoubleSlider.cpp
tangchao0503 0b4ee48355 1、实现了光谱仪简单的采集功能:曝光、调焦、暗电流、采集影像、保存影像;
2、设置光谱仪帧率、曝光时间、gain;
3、在页面中嵌入了rgb相机图传(通过opencv实现);
4、平台的相机位置模拟、x/y马达的分别控制、x/y马达的量程检测;
5、轨迹规划;
6、加入了张卓的自动调焦模块;
7、加入了自动电源控制;
2023-03-14 22:52:38 +08:00

88 lines
2.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "stdafx.h"
#include "QMotorDoubleSlider.h"
QMotorDoubleSlider::QMotorDoubleSlider(QWidget* pParent /*= NULL*/) :
QSlider(pParent),
//m_Multiplier(0.00054496986),//上海农科院修改前0.00052734375/5=0.00010546875修改后准确值为0.000544969862759644近似为0.00054496986/5=0.000108993972因为有个机械装置1脉冲距离需要除以5
m_Multiplier(0.00054496986),//兴安盟农研所
m_yMultiplier(0.000108993972)//
{
connect(this, SIGNAL(valueChanged(int)), this, SLOT(notifyValueChanged(int)));
setSingleStep(1);
setOrientation(Qt::Horizontal);
setFocusPolicy(Qt::NoFocus);
}
//向外发射
void QMotorDoubleSlider::notifyValueChanged(int Value)
{
emit valueChanged((double)Value * m_Multiplier);//////////
}
//接收外边
void QMotorDoubleSlider::setValue(double Value, bool BlockSignals)
{
QSlider::blockSignals(BlockSignals);
QSlider::setValue(Value / m_Multiplier);////////////
if (!BlockSignals)
emit valueChanged(Value);
QSlider::blockSignals(false);
}
void QMotorDoubleSlider::setRange(double Min, double Max)
{
QSlider::setRange(Min / m_Multiplier, Max / m_Multiplier);//////
emit rangeChanged(Min, Max);
}
void QMotorDoubleSlider::setMinimum(double Min)
{
QSlider::setMinimum(Min / m_Multiplier);//////
emit rangeChanged(minimum(), maximum());
}
double QMotorDoubleSlider::minimum() const
{
return QSlider::minimum() * m_Multiplier;/////
}
void QMotorDoubleSlider::setMaximum(double Max)
{
QSlider::setMaximum(Max / m_Multiplier);//////
emit rangeChanged(minimum(), maximum());
}
double QMotorDoubleSlider::maximum() const
{
return QSlider::maximum() * m_Multiplier;///////
}
double QMotorDoubleSlider::value() const
{
int Value = QSlider::value();
return (double)Value * m_Multiplier;//////
}
double QMotorDoubleSlider::OriginalValue() const
{
int Value = QSlider::value();
return (double)Value;
}
long QMotorDoubleSlider::getPositionPulse(double position)
{
return position / m_Multiplier;
}
double QMotorDoubleSlider::getDistanceFromPulse(int pulse)
{
return pulse * m_Multiplier;
}