1 Star 0 Fork 0

sirli/AxleRobotOld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
mainframdata.cpp 4.11 KB
一键复制 编辑 原始数据 按行查看 历史
sirli 提交于 2021-02-24 01:25 . base files
#include "mainframdata.h"
QString EnvmPrm::StartFlag;
QString EnvmPrm::EndFlag;
MotorPara EnvmPrm::m_MotorPara;
double EnvmPrm::JogDistance[4];
int EnvmPrm::PiontCount;
QMap<int,Point> EnvmPrm::PointMap;
EnvmPrm::EnvmPrm()
{
}
QString EnvmPrm::doubleToQString(double value, int format) //自动调整小数点
{
QString str;
str=QString::number(value,'f');
if(format==0)
{
while (str.endsWith('0'))
{
str = str.left(str.length()-1);
}
if(str.endsWith('.'))
str.replace(".","");
}
return str;
}
void shareIO::setLimit_positive(long value)
{
QMutex Mutex;
Mutex.lock();
Limit_positive=value;
Mutex.unlock();
}
void shareIO::setLimit_negative(long value)
{
QMutex Mutex;
Mutex.lock();
Limit_negative=value;
Mutex.unlock();
}
void shareIO::setAlarm(long value)
{
QMutex Mutex;
Mutex.lock();
Alarm=value;
Mutex.unlock();
}
void shareIO::setHome(long value)
{
QMutex Mutex;
Mutex.lock();
Home=value;
Mutex.unlock();
}
void shareIO::setArrive(long value)
{
QMutex Mutex;
Mutex.lock();
Arrive=value;
Mutex.unlock();
}
void shareIO::setGPI_Value(long value)
{
QMutex Mutex;
Mutex.lock();
GPI_Value=value;
Mutex.unlock();
}
long shareIO::getLimit_positive()
{
QMutex Mutex;
Mutex.lock();
long value=Limit_positive;
Mutex.unlock();
return value;
}
long shareIO::getLimit_negative()
{
QMutex Mutex;
Mutex.lock();
long value=Limit_negative;
Mutex.unlock();
return value;
}
long shareIO::getAlarm()
{
QMutex Mutex;
Mutex.lock();
long value=Alarm;
Mutex.unlock();
return value;
}
long shareIO::getHome()
{
QMutex Mutex;
Mutex.lock();
long value=Home;
Mutex.unlock();
return value;
}
long shareIO::getArrive()
{
QMutex Mutex;
Mutex.lock();
long value=Arrive;
Mutex.unlock();
return value;
}
long shareIO::getGPI_value()
{
QMutex Mutex;
Mutex.lock();
long value=GPI_Value;
Mutex.unlock();
return value;
}
void shareIO::setEnable(long value)
{
QMutex Mutex;
Mutex.lock();
Enable=value;
Mutex.unlock();
}
void shareIO::setClear(long value)
{
QMutex Mutex;
Mutex.lock();
Clear=value;
Mutex.unlock();
}
void shareIO::setGPO_value(long value)
{
QMutex Mutex;
Mutex.lock();
GPO_value=value;
Mutex.unlock();
}
void shareIO::setEnableBit(short index, short value)
{
char Bit;
QMutex Mutex;
Mutex.lock();
long EN=Enable ;
Mutex.unlock();
if(value==0)
{
Bit='0'; //low
}
else
{
Bit='1'; //higth
}
QString strV=QString::number(EN,2).rightJustified(8,'0');
QString str=strV.replace(7-index,Bit);
bool ok;
long temp=str.toInt(&ok,2);
setEnable(temp);
}
void shareIO::setClearBit(short index, short value)
{
char Bit;
QMutex Mutex;
Mutex.lock();
long CLR=Clear;
Mutex.unlock();
if(value==0)
{
Bit='0'; //low
}
else
{
Bit='1'; //higth
}
QString strV=QString::number(CLR,2).rightJustified(8,'0');
QString str=strV.replace(7-index,Bit);
bool ok;
long temp=str.toInt(&ok,2);
setEnable(temp);
}
void shareIO::setGPO_valueBit(short index, short value)
{
char Bit;
QMutex Mutex;
Mutex.lock();
long GPO=GPO_value;
Mutex.unlock();
if(value==0)
{
Bit='0'; //low
}
else
{
Bit='1'; //higth
}
QString strV=QString::number(GPO,2).rightJustified(16,'0');
QString str=strV.replace(15-index,Bit);
bool ok;
long temp=str.toInt(&ok,2);
setGPO_value(temp);
}
long shareIO::getEnable()
{
QMutex Mutex;
Mutex.lock();
long value=Enable;
Mutex.unlock();
return value;
}
long shareIO::getClear()
{
QMutex Mutex;
Mutex.lock();
long value=Clear;
Mutex.unlock();
return value;
}
long shareIO::getGPO_value()
{
QMutex Mutex;
Mutex.lock();
long value=GPO_value;
Mutex.unlock();
return value;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lixin3216/AxleRobotOld.git
git@gitee.com:lixin3216/AxleRobotOld.git
lixin3216
AxleRobotOld
AxleRobotOld
master

搜索帮助