添加修改参数的IAS_SEL,修正通讯强度,和传输速率
This commit is contained in:
+175
-22
@@ -166,6 +166,89 @@ void CommandBox::setFloatFlag(bool flag)
|
||||
floatflag = flag;
|
||||
}
|
||||
|
||||
float CommandBox::param_getvalue(QVariant param,uint8_t type)
|
||||
{
|
||||
float value;
|
||||
union {
|
||||
uint8_t u8[8];
|
||||
int8_t i8[8];
|
||||
uint16_t u16[4];
|
||||
int16_t i16[4];
|
||||
uint32_t u32[2];
|
||||
int32_t i32[2];
|
||||
uint64_t u64;
|
||||
int64_t i64;
|
||||
float f[2];
|
||||
double d;
|
||||
}src;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MAV_PARAM_TYPE_UINT8:
|
||||
{
|
||||
src.u8[0] = param.toUInt();
|
||||
((uint8_t *)&value)[0] = src.u8[0];
|
||||
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_INT8:
|
||||
{
|
||||
src.i8[0] = param.toUInt();
|
||||
((int8_t *)&value)[0] = src.i8[0];
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_UINT16:
|
||||
{
|
||||
src.u16[0] = param.toUInt();
|
||||
((uint16_t *)&value)[0] = src.u16[0];
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_INT16:
|
||||
{
|
||||
src.i16[0] = param.toUInt();
|
||||
((int16_t *)&value)[0] = src.i16[0];
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_UINT32:
|
||||
{
|
||||
src.u32[0] = param.toUInt();
|
||||
((uint32_t *)&value)[0] = (uint32_t)src.u32[0];
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_INT32:
|
||||
{
|
||||
src.i32[0] = param.toUInt();
|
||||
((int32_t *)&value)[0] = (int32_t)src.i32[0];
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_UINT64:
|
||||
{
|
||||
src.u64 = param.toUInt();
|
||||
((uint64_t *)&value)[0] = (uint64_t )src.u64;
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_INT64:
|
||||
{
|
||||
src.i64 = param.toUInt();
|
||||
((int64_t *)&value)[0] = (int64_t)src.i64;
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_REAL32:
|
||||
{
|
||||
src.f[0] = param.toFloat();
|
||||
((float *)&value)[0] = (float)src.f[0];
|
||||
}break;
|
||||
case MAV_PARAM_TYPE_REAL64:
|
||||
{
|
||||
src.d = param.toDouble();
|
||||
((double *)&value)[0]= (double)src.d;
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
src.f[0] = param.toFloat();
|
||||
((float *)&value)[0] = (float)src.i32[0];
|
||||
}break;
|
||||
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CommandBox::commandAccepted(bool flag,uint16_t command,uint8_t result)
|
||||
{
|
||||
bool isFundSender = false;
|
||||
@@ -340,26 +423,7 @@ void CommandBox::on_pushButton_SendCommand_clicked()
|
||||
else if(cmdType == 1)
|
||||
{
|
||||
|
||||
emit showMessage(tr("修改参数 ") + " " + ui->comboBox_IMU->itemText(m_value) + " " + QString::number(m_value),5000);
|
||||
|
||||
float value;
|
||||
union {
|
||||
uint8_t u8[8];
|
||||
int8_t i8[8];
|
||||
uint16_t u16[4];
|
||||
int16_t i16[4];
|
||||
uint32_t u32[2];
|
||||
int32_t i32[2];
|
||||
uint64_t u64;
|
||||
int64_t i64;
|
||||
float f[2];
|
||||
double d;
|
||||
}src;
|
||||
|
||||
src.i8[0] = m_value;
|
||||
((int8_t *)&value)[0] = src.i8[0];
|
||||
|
||||
m_value = value;
|
||||
emit showMessage(tr("修改参数 ") + " " + m_id.toLatin1().data() + " " + QString::number(m_value),5000);
|
||||
|
||||
|
||||
emit WriteCmd(m_sysid,m_compid,m_id.toLatin1().data(),m_type,m_value);
|
||||
@@ -585,8 +649,6 @@ void CommandBox::on_pushButton_IMU_clicked()
|
||||
{
|
||||
if((ui->comboBox_IMU->currentIndex() != -1)&&(ui->comboBox_sys->currentIndex() != -1))
|
||||
{
|
||||
|
||||
int8_t value = ui->comboBox_IMU->currentData(Qt::UserRole).toInt();
|
||||
uint8_t sysid = ui->comboBox_sys->currentData(Qt::UserRole).toInt();
|
||||
uint8_t compid = 1;
|
||||
QString id;
|
||||
@@ -595,6 +657,8 @@ void CommandBox::on_pushButton_IMU_clicked()
|
||||
id.clear();
|
||||
id.append("use_ext_ins");
|
||||
|
||||
float value = param_getvalue(ui->comboBox_IMU->currentData(Qt::UserRole).toInt(),type);
|
||||
|
||||
on_paramClicked(sysid,compid,id,type,value);
|
||||
|
||||
}
|
||||
@@ -609,6 +673,93 @@ void CommandBox::on_pushButton_IMU_clicked()
|
||||
}
|
||||
|
||||
|
||||
void CommandBox::on_pushButton_IAS_SEL_0_clicked()
|
||||
{
|
||||
if(ui->comboBox_sys->currentIndex() != -1)
|
||||
{
|
||||
|
||||
uint8_t sysid = ui->comboBox_sys->currentData(Qt::UserRole).toInt();
|
||||
uint8_t compid = 1;
|
||||
QString id;
|
||||
uint8_t type = MAV_PARAM_TYPE_UINT8;
|
||||
|
||||
id.clear();
|
||||
id.append("IAS_SEL");
|
||||
|
||||
|
||||
float value = param_getvalue(0,type);
|
||||
|
||||
on_paramClicked(sysid,compid,id,type,value);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox *box = new QMessageBox(this);
|
||||
|
||||
box->setWindowTitle(tr("警告"));
|
||||
box->setText(tr("请设定目标"));
|
||||
box->show();
|
||||
}
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_IAS_SEL_1_clicked()
|
||||
{
|
||||
if(ui->comboBox_sys->currentIndex() != -1)
|
||||
{
|
||||
|
||||
uint8_t sysid = ui->comboBox_sys->currentData(Qt::UserRole).toInt();
|
||||
uint8_t compid = 1;
|
||||
QString id;
|
||||
uint8_t type = MAV_PARAM_TYPE_UINT8;
|
||||
|
||||
id.clear();
|
||||
id.append("IAS_SEL");
|
||||
|
||||
float value = param_getvalue(1,type);
|
||||
|
||||
on_paramClicked(sysid,compid,id,type,value);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox *box = new QMessageBox(this);
|
||||
|
||||
box->setWindowTitle(tr("警告"));
|
||||
box->setText(tr("请设定目标"));
|
||||
box->show();
|
||||
}
|
||||
}
|
||||
|
||||
void CommandBox::on_pushButton_IAS_SEL_2_clicked()
|
||||
{
|
||||
if(ui->comboBox_sys->currentIndex() != -1)
|
||||
{
|
||||
uint8_t sysid = ui->comboBox_sys->currentData(Qt::UserRole).toInt();
|
||||
uint8_t compid = 1;
|
||||
QString id;
|
||||
uint8_t type = MAV_PARAM_TYPE_UINT8;
|
||||
|
||||
id.clear();
|
||||
id.append("IAS_SEL");
|
||||
|
||||
float value = param_getvalue(2,type);
|
||||
|
||||
on_paramClicked(sysid,compid,id,type,value);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox *box = new QMessageBox(this);
|
||||
|
||||
box->setWindowTitle(tr("警告"));
|
||||
box->setText(tr("请设定目标"));
|
||||
box->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CommandBox::addVehicles(int sysid, int compid)
|
||||
{
|
||||
Q_UNUSED(compid)
|
||||
@@ -786,3 +937,5 @@ void CommandBox::on_pushButton_test_stop_clicked()
|
||||
on_commandClicked(tr("设定 %1").arg(ui->pushButton_test_stop->text()),
|
||||
0,0,0,0,0,0,0,20008,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user