666 lines
21 KiB
C++
666 lines
21 KiB
C++
#include "mainwindow.h"
|
|
#include "./ui_mainwindow.h"
|
|
#include <QLibrary>
|
|
#include <QHostAddress>
|
|
#include <QFileDialog>
|
|
#include <QDateTime>
|
|
|
|
QFile *rec_file = NULL;
|
|
|
|
extern "C"{
|
|
#include "ET39_SIL_capi.h"
|
|
|
|
void hal_uart_out_Start_wrapper(const uint8_T *uart_id, const int_T p_width0)
|
|
{
|
|
QString filename = QString("sil")
|
|
+QDateTime::currentDateTime().toString("yyyyMMddhhmmss")
|
|
+".DAT";
|
|
rec_file = new QFile(filename, NULL);
|
|
|
|
if (!rec_file->open(QFile::WriteOnly))
|
|
{
|
|
delete rec_file;
|
|
rec_file = NULL;
|
|
}
|
|
}
|
|
|
|
void hal_uart_out_Outputs_wrapper(const uint8_T *buff,
|
|
const uint16_T *len,
|
|
const uint8_T *sep,
|
|
int32_T *ErrorCode,
|
|
const uint8_T *uart_id, const int_T p_width0,
|
|
const int_T u_width)
|
|
{
|
|
static uint8_t seq_rec;
|
|
ErrorCode[0] = -1;
|
|
switch (uart_id[0])
|
|
{
|
|
case 4:
|
|
if (seq_rec != sep[0])
|
|
{
|
|
seq_rec = sep[0];
|
|
if (rec_file)
|
|
{
|
|
if (rec_file->write((const char *)buff, len[0]) == len[0])
|
|
{
|
|
ErrorCode[0] = 0;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void MainWindow::scan_param()
|
|
{
|
|
const rtwCAPI_ModelMappingStaticInfo *sm = (*getmap_func)();
|
|
if (sm)
|
|
{
|
|
//unsigned int n = rtwCAPI_GetNumBlockParametersFromStaticMap(sm);
|
|
unsigned int m = rtwCAPI_GetNumModelParametersFromStaticMap(sm);
|
|
ui->tableWidget->setRowCount(1024);
|
|
QStringList hdr;
|
|
hdr.push_back(tr("Parameter"));
|
|
hdr.push_back(tr("Value"));
|
|
ui->tableWidget->setHorizontalHeaderLabels(hdr);
|
|
int cur = 0;
|
|
|
|
rtwCAPI_ModelParameters const *prm = rtwCAPI_GetModelParametersFromStaticMap(sm);
|
|
rtwCAPI_DataTypeMap const *dtm = rtwCAPI_GetDataTypeMapFromStaticMap(sm);
|
|
rtwCAPI_DimensionMap const *dmm = rtwCAPI_GetDimensionMapFromStaticMap(sm);
|
|
uint_T const *dam = rtwCAPI_GetDimensionArrayFromStaticMap(sm);
|
|
rtwCAPI_ModelMappingInfo *MMI = &(rtmGetDataMapInfo(this->m).mmi);
|
|
void **da = rtwCAPI_GetDataAddressMap(MMI);
|
|
for (unsigned int i = 0; i < m; ++i)
|
|
{
|
|
const char *name = rtwCAPI_GetModelParameterName(prm, i);
|
|
int idx = rtwCAPI_GetModelParameterAddrIdx(prm, i);
|
|
uint16_t dti = rtwCAPI_GetModelParameterDataTypeIdx(prm, i);
|
|
uint16_t dmi = rtwCAPI_GetModelParameterDimensionIdx(prm, i);
|
|
uint8_t ss = rtwCAPI_GetDataTypeSLId(dtm, dti);
|
|
uint16_t dai = rtwCAPI_GetDimArrayIndex(dmm, dmi);
|
|
uint8_t nd = rtwCAPI_GetNumDims(dmm, dmi);
|
|
uint16_t n = 1;
|
|
for (int j = 0; j < nd; ++j)
|
|
{
|
|
n *= dam[dai + j];
|
|
}
|
|
for (int j = 0; j < n; ++j)
|
|
{
|
|
QString param_name = QString::fromLatin1(name);
|
|
if (j>0)
|
|
{
|
|
param_name = param_name+QString("(%1)").arg(j);
|
|
}
|
|
QString param_value;
|
|
switch (ss)
|
|
{
|
|
case SS_DOUBLE:
|
|
{
|
|
double *d = (double *)da[idx];
|
|
param_value = QString("%1").arg(d[j],0,'g',12);
|
|
}
|
|
break;
|
|
case SS_SINGLE:
|
|
{
|
|
float *s = (float *)da[idx];
|
|
param_value = QString("%1").arg(s[j]);
|
|
}
|
|
break;
|
|
case SS_INT8:
|
|
{
|
|
int8_T *c = (int8_T *)da[idx];
|
|
param_value = QString("%1").arg(c[j]);
|
|
}
|
|
break;
|
|
case SS_INT16:
|
|
{
|
|
int16_T *h = (int16_T *)da[idx];
|
|
param_value = QString("%1").arg(h[j]);
|
|
}
|
|
break;
|
|
case SS_INT32:
|
|
{
|
|
int32_T *I = (int32_T *)da[idx];
|
|
param_value = QString("%1").arg(I[j]);
|
|
}
|
|
break;
|
|
case SS_UINT8:
|
|
{
|
|
uint8_T *c = (uint8_T *)da[idx];
|
|
param_value = QString("%1").arg(c[j]);
|
|
}
|
|
break;
|
|
case SS_UINT16:
|
|
{
|
|
uint16_T *h = (uint16_T *)da[idx];
|
|
param_value = QString("%1").arg(h[j]);
|
|
}
|
|
break;
|
|
case SS_UINT32:
|
|
{
|
|
uint32_T *I = (uint32_T *)da[idx];
|
|
param_value = QString("%1").arg(I[j]);
|
|
}
|
|
break;
|
|
}
|
|
QTableWidgetItem *newItem = new QTableWidgetItem(param_name);
|
|
ui->tableWidget->setItem(cur, 0, newItem);
|
|
newItem = new QTableWidgetItem(param_value);
|
|
ui->tableWidget->setItem(cur++, 1, newItem);
|
|
if (param_name == "X0")
|
|
{
|
|
X0[0] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "X0(1)")
|
|
{
|
|
X0[1] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "X0(2)")
|
|
{
|
|
X0[2] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "Att0")
|
|
{
|
|
Att0[0] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "Att0(1)")
|
|
{
|
|
Att0[1] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "Att0(2)")
|
|
{
|
|
Att0[2] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "V0")
|
|
{
|
|
V0[0] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "V0(1)")
|
|
{
|
|
V0[1] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "V0(2)")
|
|
{
|
|
V0[2] = param_value.toDouble();
|
|
}
|
|
else if (param_name == "hground")
|
|
{
|
|
hground = param_value.toDouble();
|
|
}
|
|
}
|
|
}
|
|
ui->tableWidget->setRowCount(cur);
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::setup_param(const QVector<QString> &head, const QVector<double> &onecase)
|
|
{
|
|
const rtwCAPI_ModelMappingStaticInfo *sm = (*getmap_func)();
|
|
if (sm)
|
|
{
|
|
//unsigned int n = rtwCAPI_GetNumBlockParametersFromStaticMap(sm);
|
|
unsigned int m = rtwCAPI_GetNumModelParametersFromStaticMap(sm);
|
|
rtwCAPI_ModelParameters const *prm = rtwCAPI_GetModelParametersFromStaticMap(sm);
|
|
rtwCAPI_DataTypeMap const *dtm = rtwCAPI_GetDataTypeMapFromStaticMap(sm);
|
|
rtwCAPI_DimensionMap const *dmm = rtwCAPI_GetDimensionMapFromStaticMap(sm);
|
|
uint_T const *dam = rtwCAPI_GetDimensionArrayFromStaticMap(sm);
|
|
rtwCAPI_ModelMappingInfo *MMI = &(rtmGetDataMapInfo(this->m).mmi);
|
|
void **da = rtwCAPI_GetDataAddressMap(MMI);
|
|
for (unsigned int i = 0; i < m; ++i)
|
|
{
|
|
const char *name = rtwCAPI_GetModelParameterName(prm, i);
|
|
int idx = rtwCAPI_GetModelParameterAddrIdx(prm, i);
|
|
uint16_t dti = rtwCAPI_GetModelParameterDataTypeIdx(prm, i);
|
|
uint16_t dmi = rtwCAPI_GetModelParameterDimensionIdx(prm, i);
|
|
uint8_t ss = rtwCAPI_GetDataTypeSLId(dtm, dti);
|
|
uint16_t dai = rtwCAPI_GetDimArrayIndex(dmm, dmi);
|
|
uint8_t nd = rtwCAPI_GetNumDims(dmm, dmi);
|
|
uint16_t n = 1;
|
|
for (int j = 0; j < nd; ++j)
|
|
{
|
|
n *= dam[dai + j];
|
|
}
|
|
int j = 0;
|
|
for (auto i = head.begin(); i != head.end(); ++i, ++j)
|
|
{
|
|
QStringList s = i->split(QRegExp("[()]"));
|
|
if (*i == name || ((s.size() >= 2) && (s.value(0) == name)))
|
|
{
|
|
int target_idx = 0;
|
|
double target_value = onecase[j];
|
|
if (s.size() >= 2)
|
|
{
|
|
target_idx = s.value(1).toInt();
|
|
}
|
|
switch (ss)
|
|
{
|
|
case SS_DOUBLE:
|
|
{
|
|
double *d = (double *)da[idx];
|
|
d[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_SINGLE:
|
|
{
|
|
float *s = (float *)da[idx];
|
|
s[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_INT8:
|
|
{
|
|
int8_T *c = (int8_T *)da[idx];
|
|
c[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_INT16:
|
|
{
|
|
int16_T *h = (int16_T *)da[idx];
|
|
h[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_INT32:
|
|
{
|
|
int32_T *I = (int32_T *)da[idx];
|
|
I[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_UINT8:
|
|
{
|
|
uint8_T *c = (uint8_T *)da[idx];
|
|
c[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_UINT16:
|
|
{
|
|
uint16_T *h = (uint16_T *)da[idx];
|
|
h[target_idx] = target_value;
|
|
}
|
|
break;
|
|
case SS_UINT32:
|
|
{
|
|
uint32_T *I = (uint32_T *)da[idx];
|
|
I[target_idx] = target_value;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent), ui(new Ui::MainWindow), times(1), idx(0)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
QLibrary *mdl = new QLibrary("ET39_SIL_win64.dll");
|
|
if (mdl->isLoaded())
|
|
{
|
|
init_func = static_cast<ET39_SIL_initialize_ptr>(mdl->resolve("ET39_SIL_initialize"));
|
|
step_func = static_cast<ET39_SIL_step_ptr>(mdl->resolve("ET39_SIL_step"));
|
|
getmap_func = (ET39_SIL_GetCAPIStaticMap_ptr)(mdl->resolve("ET39_SIL_GetCAPIStaticMap"));
|
|
u = (ExtU_ET39_SIL_T *)mdl->resolve("ET39_SIL_U");
|
|
y = (ExtY_ET39_SIL_T *)mdl->resolve("ET39_SIL_Y");
|
|
m = (RT_MODEL_ET39_SIL_T *)mdl->resolve("ET39_SIL_M_");
|
|
}
|
|
else
|
|
{
|
|
init_func = &ET39_SIL_initialize;
|
|
step_func = &ET39_SIL_step;
|
|
getmap_func = &ET39_SIL_GetCAPIStaticMap;
|
|
u = &ET39_SIL_U;
|
|
y = &ET39_SIL_Y;
|
|
m = (RT_MODEL_ET39_SIL_T *)ET39_SIL_M;
|
|
}
|
|
|
|
ui->pushButton_start->setText(QString("Fail"));
|
|
stage = 0;
|
|
|
|
if (init_func && step_func && u && y && getmap_func)
|
|
{
|
|
ET39_SIL_InitializeDataMapInfo();
|
|
scan_param();
|
|
|
|
ui->lineEditLat->setText(QString("%1").arg(X0[0],0,'g',12));
|
|
ui->lineEditLon->setText(QString("%1").arg(X0[1],0,'g',12));
|
|
ui->lineEditAlt->setText(QString("%1").arg(hground));
|
|
ui->lineEditHdg->setText(QString("%1").arg(Att0[2]*57.3));
|
|
ui->lineEditSpeed->setText(QString("%1").arg(V0[0]));
|
|
gear_height = X0[2] - hground;
|
|
ui->lineEditAGL->setText(QString("%1").arg(gear_height));
|
|
|
|
qgc_sock = new QUdpSocket(this);
|
|
if (qgc_sock->bind(QHostAddress::LocalHost, 6030))
|
|
{
|
|
ui->pushButton_start->setText(QString("Start"));
|
|
stage = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void MainWindow::update333Hz(void)
|
|
{
|
|
for (int j=0;j<times;++j)
|
|
{
|
|
u->data_len = 0u;
|
|
if (qgc_sock->hasPendingDatagrams())
|
|
{
|
|
qint64 len = qgc_sock->readDatagram((char *)u->data_in, 255);
|
|
if (len > 0)
|
|
{
|
|
u->data_len = static_cast<uint16_t>(len);
|
|
}
|
|
}
|
|
|
|
(*step_func)();
|
|
|
|
if (y->seq != seq)
|
|
{
|
|
seq = y->seq;
|
|
qgc_sock->writeDatagram((char *)y->buff, y->buff_len, QHostAddress::LocalHost, 6010);
|
|
}
|
|
}
|
|
if (++idx >= 33)
|
|
{
|
|
idx = 0;
|
|
ui->lineEditDel->setText(QString("%1").arg(y->del*57.3,6,'f',2));
|
|
ui->lineEditDer->setText(QString("%1").arg(y->der*57.3,6,'f',2));
|
|
ui->lineEditDal->setText(QString("%1").arg(y->dal*57.3,6,'f',2));
|
|
ui->lineEditDar->setText(QString("%1").arg(y->dar*57.3,6,'f',2));
|
|
if (ui->checkBoxTurbine->checkState() == Qt::Checked)
|
|
{
|
|
u->fault |= 1;
|
|
}
|
|
else
|
|
{
|
|
u->fault &= 0xFFFFFFFE;
|
|
}
|
|
if (ui->checkBoxDel->checkState() == Qt::Checked)
|
|
{
|
|
u->fault |= 2;
|
|
}
|
|
else
|
|
{
|
|
u->fault &= 0xFFFFFFFD;
|
|
}
|
|
if (ui->checkBoxDer->checkState() == Qt::Checked)
|
|
{
|
|
u->fault |= 4;
|
|
}
|
|
else
|
|
{
|
|
u->fault &= 0xFFFFFFFB;
|
|
}
|
|
if (ui->checkBoxDr->checkState() == Qt::Checked)
|
|
{
|
|
u->fault |= 8;
|
|
}
|
|
else
|
|
{
|
|
u->fault &= 0xFFFFFFF7;
|
|
}
|
|
if (ui->checkBoxDal->checkState() == Qt::Checked)
|
|
{
|
|
u->fault |= 0x10;
|
|
}
|
|
else
|
|
{
|
|
u->fault &= 0xFFFFFFEF;
|
|
}
|
|
if (ui->checkBoxDar->checkState() == Qt::Checked)
|
|
{
|
|
u->fault |= 0x20;
|
|
}
|
|
else
|
|
{
|
|
u->fault &= 0xFFFFFFDF;
|
|
}
|
|
|
|
if (acmi_sock && ui->checkBoxACMI->checkState() == Qt::Checked)
|
|
{
|
|
acmi.lon = y->sens.lon;
|
|
acmi.lat = y->sens.lat;
|
|
acmi.alt = y->sens.msl+3;
|
|
acmi.roll = y->sens.phi*57.3;
|
|
acmi.pitch = y->sens.tht*57.3;
|
|
acmi.yaw = y->sens.psi*57.3;
|
|
|
|
QByteArray acmi_buf = QString("%1,T=%2|%3|%4|%5|%6|%7\n")
|
|
.arg(1)
|
|
.arg(acmi.lon, 0, 'f', 7)
|
|
.arg(acmi.lat, 0, 'f', 7)
|
|
.arg(acmi.alt, 0, 'f', 2)
|
|
.arg(acmi.roll, 0, 'f', 2)
|
|
.arg(acmi.pitch, 0, 'f', 2)
|
|
.arg(acmi.yaw, 0, 'f', 2)
|
|
.toLatin1();
|
|
acmi_sock->writeDatagram(acmi_buf, acmi_addr, acmi_port);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MainWindow::onFire()
|
|
{
|
|
if (stage == 1)
|
|
{
|
|
QVector<QString> head;
|
|
QVector<double> onecase;
|
|
|
|
int n = ui->tableWidget->rowCount();
|
|
for (int i=0;i<n;++i)
|
|
{
|
|
head.push_back(ui->tableWidget->item(i,0)->text());
|
|
onecase.push_back(ui->tableWidget->item(i,1)->text().toDouble());
|
|
}
|
|
|
|
double val;
|
|
bool ok;
|
|
val = ui->lineEditLat->text().toDouble(&ok);
|
|
if (ok)
|
|
{
|
|
head.push_back("X0");
|
|
onecase.push_back(val);
|
|
}
|
|
|
|
val = ui->lineEditLon->text().toDouble(&ok);
|
|
if (ok)
|
|
{
|
|
head.push_back("X0(1)");
|
|
onecase.push_back(val);
|
|
}
|
|
|
|
double hground;
|
|
val = ui->lineEditAlt->text().toDouble(&ok);
|
|
if (ok)
|
|
{
|
|
hground = val;
|
|
head.push_back("hground");
|
|
onecase.push_back(hground);
|
|
if (ui->radioButtonOnGround->isChecked())
|
|
{
|
|
head.push_back("X0(2)");
|
|
onecase.push_back(hground+gear_height);
|
|
}
|
|
}
|
|
|
|
val = ui->lineEditHdg->text().toDouble(&ok);
|
|
if (ok)
|
|
{
|
|
head.push_back("Att0(2)");
|
|
onecase.push_back(val/57.3);
|
|
}
|
|
|
|
if (ui->radioButtonInAir->isChecked())
|
|
{
|
|
head.push_back("Att0(1)");
|
|
onecase.push_back(0);
|
|
val = ui->lineEditSpeed->text().toDouble(&ok);
|
|
if (ok)
|
|
{
|
|
head.push_back("V0");
|
|
onecase.push_back(val);
|
|
}
|
|
val = ui->lineEditAGL->text().toDouble(&ok);
|
|
if (ok)
|
|
{
|
|
head.push_back("X0(2)");
|
|
onecase.push_back(hground+val);
|
|
}
|
|
}
|
|
|
|
setup_param(head, onecase);
|
|
(*init_func)();
|
|
|
|
if (!acmi_sock)
|
|
{
|
|
bool ok;
|
|
QStringList addr_port = ui->lineEditACMI->text().split(':');
|
|
|
|
acmi_addr = QHostAddress(addr_port[0]);
|
|
acmi_port = addr_port[1].toInt(&ok);
|
|
if (ok && acmi_port > 0 && acmi_port < 65535)
|
|
{
|
|
acmi_sock = new QUdpSocket(this);
|
|
QByteArray acmi_buf = QString("%1,Name=B737,Width=5,"
|
|
"ShortName=929,LongName=CR929,FullName=CR929 6%-scaled,"
|
|
"Type=Minor+Air+FixedWing,Color=Red\n")
|
|
.arg(1)
|
|
.toLatin1();
|
|
acmi_sock->writeDatagram(acmi_buf, acmi_addr, acmi_port);
|
|
}
|
|
}
|
|
|
|
seq = 0;
|
|
|
|
timer333Hz = new QTimer(this);
|
|
connect(timer333Hz, SIGNAL(timeout()), this, SLOT(update333Hz()));
|
|
timer333Hz->start(5);
|
|
|
|
if (ui->radioButtonOnGround->isChecked())
|
|
{
|
|
stage = 3;
|
|
ui->pushButton_start->setText(QString("Flying"));
|
|
ui->pushButtonLaunch->setText(QString("Flying"));
|
|
ui->pushButton_start->setEnabled(false);
|
|
ui->pushButtonLaunch->setEnabled(false);
|
|
ui->tabWidget->setCurrentIndex(1);
|
|
u->fault = 0x0;
|
|
}
|
|
if (ui->radioButtonInAir->isChecked())
|
|
{
|
|
stage = 3;
|
|
ui->pushButton_start->setText(QString("Flying"));
|
|
ui->pushButtonLaunch->setText(QString("Flying"));
|
|
ui->pushButton_start->setEnabled(false);
|
|
ui->pushButtonLaunch->setEnabled(false);
|
|
ui->tabWidget->setCurrentIndex(1);
|
|
u->fault = 0x40;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::onExport()
|
|
{
|
|
QString filename = QFileDialog::getSaveFileName(this, tr("Save to"), QString(), tr("Text File (*.txt)"));
|
|
if (!filename.isEmpty())
|
|
{
|
|
QFile data(filename);
|
|
if (data.open(QFile::WriteOnly | QFile::Truncate)) {
|
|
QTextStream out(&data);
|
|
int n = ui->tableWidget->rowCount();
|
|
for (int i=0;i<n;++i)
|
|
{
|
|
out << ui->tableWidget->item(i,0)->text() << ',';
|
|
out << ui->tableWidget->item(i,1)->text() << '\n';
|
|
}
|
|
out << QString("X0") << ',' << ui->lineEditLat->text() << '\n';
|
|
out << QString("X0(1)") << ',' << ui->lineEditLon->text() << '\n';
|
|
out << QString("hground") << ',' << ui->lineEditAlt->text() << '\n';
|
|
out << QString("Att0(2)") << ',' << ui->lineEditHdg->text().toDouble()/57.3 << '\n';
|
|
}
|
|
}
|
|
}
|
|
|
|
void MainWindow::onImport()
|
|
{
|
|
QString filename = QFileDialog::getOpenFileName(this, tr("Save to"), QString(), tr("Text File (*.txt)"));
|
|
if (!filename.isEmpty())
|
|
{
|
|
QFile data(filename);
|
|
if (data.open(QFile::ReadOnly)) {
|
|
QTextStream stream(&data);
|
|
QString line;
|
|
while (stream.readLineInto(&line)) {
|
|
QStringList items = line.split(QString(","));
|
|
int n = ui->tableWidget->rowCount();
|
|
for (int i=0;i<n;++i)
|
|
{
|
|
if (ui->tableWidget->item(i,0)->text() == items[0])
|
|
{
|
|
ui->tableWidget->item(i,1)->setText(items[1]);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
int n = ui->tableWidget->rowCount();
|
|
for (int i=0;i<n;++i)
|
|
{
|
|
if (ui->tableWidget->item(i,0)->text() == "X0")
|
|
{
|
|
ui->lineEditLat->setText(ui->tableWidget->item(i,1)->text());
|
|
}
|
|
else if (ui->tableWidget->item(i,0)->text() == "X0(1)")
|
|
{
|
|
ui->lineEditLon->setText(ui->tableWidget->item(i,1)->text());
|
|
}
|
|
else if (ui->tableWidget->item(i,0)->text() == "hground")
|
|
{
|
|
ui->lineEditAlt->setText(ui->tableWidget->item(i,1)->text());
|
|
}
|
|
else if (ui->tableWidget->item(i,0)->text() == "Att0(2)")
|
|
{
|
|
ui->lineEditHdg->setText(QString("%1").arg(ui->tableWidget->item(i,1)->text().toDouble()*57.3));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void MainWindow::onTimes(int i)
|
|
{
|
|
times = i;
|
|
}
|
|
|
|
void MainWindow::onAG()
|
|
{
|
|
if (ui->radioButtonOnGround->isChecked())
|
|
{
|
|
ui->lineEditSpeed->setEnabled(false);
|
|
ui->lineEditAGL->setEnabled(false);
|
|
}
|
|
if (ui->radioButtonInAir->isChecked())
|
|
{
|
|
ui->lineEditSpeed->setEnabled(true);
|
|
ui->lineEditAGL->setEnabled(true);
|
|
}
|
|
}
|