把忘记提交的重新添加回来
This commit is contained in:
@@ -172,10 +172,47 @@ ServoSystem::ServoSystem(QWidget *parent) :
|
||||
});
|
||||
|
||||
|
||||
HILStateFile = new QFile(QString("./log/Other/HILState%1.csv").arg(QDateTime::currentDateTime().toString("yyyyMMddHHmmss")));
|
||||
HILStateFile->open(QIODevice::WriteOnly);
|
||||
|
||||
if(HILStateFile)
|
||||
{
|
||||
QString data;
|
||||
|
||||
data.clear();
|
||||
data.append("year,mon,day,hour,min,sec,ms,");
|
||||
data.append("parse"); data.append(",");
|
||||
data.append("comm"); data.append(",");
|
||||
data.append("parse"); data.append(",");
|
||||
data.append("comm"); data.append("\n");
|
||||
|
||||
|
||||
|
||||
|
||||
QTextStream stream(HILStateFile);
|
||||
stream << data;
|
||||
HILStateFile->flush();
|
||||
}
|
||||
|
||||
/*
|
||||
ui->comboBox_HoverDir->addItem("左盘旋",-1);
|
||||
ui->comboBox_HoverDir->addItem("右盘旋",1);
|
||||
ui->comboBox_HoverDir->setCurrentIndex(1);
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
ServoSystem::~ServoSystem()
|
||||
{
|
||||
if (HILStateFile)
|
||||
{
|
||||
HILStateFile->close();
|
||||
delete HILStateFile;
|
||||
HILStateFile = NULL;
|
||||
}
|
||||
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -397,8 +434,64 @@ void ServoSystem::setHILMode(QString mode)
|
||||
emit showMessage((mode.toInt()>0)?("进入HIL仿真"):("退出HIL仿真"));
|
||||
}
|
||||
|
||||
void ServoSystem::setSimulatorState(bool paser,bool comm)
|
||||
{
|
||||
|
||||
|
||||
QString state;
|
||||
|
||||
state = (comm)?("通讯正常"):("通讯丢失");
|
||||
|
||||
|
||||
if(comm == true)
|
||||
{
|
||||
//通讯正常
|
||||
if(paser == true)
|
||||
{
|
||||
state = "通讯正常,解析正确";
|
||||
}
|
||||
else
|
||||
{
|
||||
state = "通讯正常,解析错误";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state = "通讯丢失";
|
||||
}
|
||||
|
||||
|
||||
ui->label_simulator->setText(state);
|
||||
|
||||
|
||||
if(HILStateFile)
|
||||
{
|
||||
QString data;
|
||||
|
||||
data.clear();
|
||||
QDateTime time = QDateTime::currentDateTime();
|
||||
|
||||
data.append(QString::number(time.date().year())); data.append(",");
|
||||
data.append(QString::number(time.date().month())); data.append(",");
|
||||
data.append(QString::number(time.date().day())); data.append(",");
|
||||
data.append(QString::number(time.time().hour())); data.append(",");
|
||||
data.append(QString::number(time.time().minute())); data.append(",");
|
||||
data.append(QString::number(time.time().second())); data.append(",");
|
||||
data.append(QString::number(time.time().msec())); data.append(",");
|
||||
|
||||
data.append(paser?("1"):("0")); data.append(",");
|
||||
data.append(comm?("1"):("0")); data.append(",");
|
||||
data.append((paser)?("parse ok"):("parse error")); data.append(",");
|
||||
data.append((comm)?("connet"):("lost")); data.append("\n");
|
||||
|
||||
QTextStream stream(HILStateFile);
|
||||
stream << data;
|
||||
HILStateFile->flush();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
float ServoSystem::param_getvalue(QVariant param,uint8_t type)
|
||||
{
|
||||
float value;
|
||||
|
||||
Reference in New Issue
Block a user