把忘记提交的重新添加回来
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;
|
||||
|
||||
@@ -165,6 +165,7 @@ public slots:
|
||||
|
||||
void setAPversion(QString ver);
|
||||
void setHILMode(QString mode);
|
||||
void setSimulatorState(bool paser, bool comm);
|
||||
|
||||
void setServoOffset(QVariant dirla, QVariant dirra, QVariant dirle, QVariant dirre, QVariant dirru,
|
||||
QVariant maxla, QVariant maxra, QVariant maxle, QVariant maxre, QVariant maxru,
|
||||
@@ -237,6 +238,8 @@ private:
|
||||
bool isWaitPitotClose = true;
|
||||
bool isWaitTracerAck = false;
|
||||
|
||||
QFile *HILStateFile;
|
||||
|
||||
};
|
||||
|
||||
#endif // SERVOSYSTEM_H
|
||||
|
||||
@@ -1172,27 +1172,8 @@
|
||||
<string>版本信息</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_26">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>飞控固件版本号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_APVer">
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_simulator">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
@@ -1207,7 +1188,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_31">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -1226,7 +1207,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_33">
|
||||
<property name="text">
|
||||
<string>仿真机状态:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_HILMode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -1242,6 +1230,41 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_APVer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(205, 205, 205);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>飞控固件版本号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -1688,6 +1688,10 @@ void MainWindow::updateUI()//事件驱动式更新数据
|
||||
healthui->setState(25,getBit(enable,7)?(HealthUI::state::success):(HealthUI::state::failure));//安控区
|
||||
healthui->setValueState(25,getBit(enable,7)?(tr("安控区内")):(tr("安控区外")));//安控区
|
||||
|
||||
if(toolsui->servosystem)
|
||||
{
|
||||
toolsui->servosystem->setSimulatorState(getBit(enable,11),getBit(enable,12));
|
||||
}
|
||||
|
||||
if(((vehicle.turbinstate.SysState & 0x000F) == 0x04) ||
|
||||
((vehicle.turbinstate.SysState & 0x000F) == 0x00))
|
||||
|
||||
@@ -863,10 +863,6 @@ void MavLinkNode::Mavlinkparse(quint32 src,QByteArray datagram)
|
||||
|
||||
for (QByteArray::const_iterator i = datagram.cbegin(); i != datagram.cend(); ++i)
|
||||
{
|
||||
|
||||
//QApplication::processEvents();
|
||||
|
||||
|
||||
if(MAVLINK_FRAMING_OK == mavlink_parse_char(src,*i,&msg,&status))
|
||||
{
|
||||
parserSuccess += 1;
|
||||
|
||||
@@ -22,6 +22,7 @@ statusprocess::statusprocess(QObject *parent) : ThreadTemplet(parent)
|
||||
|
||||
data.clear();
|
||||
data.append("date"); data.append(",");
|
||||
data.append("year,mon,day,hour,min,sec,ms,");data.append(",");
|
||||
data.append("elapse"); data.append(",");
|
||||
data.append("custom_mode "); data.append(",");
|
||||
data.append("type "); data.append(",");
|
||||
@@ -108,6 +109,18 @@ void statusprocess::process()//线程函数
|
||||
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(QDateTime::currentDateTimeUtc().toString("yyyy.MM.dd HH:mm:ss:zzz")); data.append(",");
|
||||
data.append(QString::number(QTime::currentTime().msecsSinceStartOfDay() - timeCount)); data.append(",");
|
||||
data.append(QString::number(m_heartbeat.custom_mode)); data.append(",");
|
||||
|
||||
Reference in New Issue
Block a user