b
This commit is contained in:
+13
-459
@@ -15,6 +15,11 @@ StatusUI::StatusUI(QWidget *parent) :
|
||||
this->setStyleSheet(stylesheet);
|
||||
file.close();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
StatusUI::~StatusUI()
|
||||
@@ -38,476 +43,25 @@ void StatusUI::setValue(QLabel *w,QString s)
|
||||
w->setText(s);
|
||||
}
|
||||
|
||||
void StatusUI::install(int flag, QString t,QVariant v,StateWidget::state s,int index)
|
||||
void StatusUI::install(int flag, QString name, QVariant value)
|
||||
{
|
||||
StateWidget *w = new StateWidget(flag,t,v,s,index);
|
||||
StateWidget *w = new StateWidget(flag,name,value);
|
||||
|
||||
|
||||
|
||||
StateList.insert(index,w);
|
||||
|
||||
|
||||
StateList.insert(name,w);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void StatusUI::setMode(uint32_t pos,QVariant value1,QVariant value2)
|
||||
void StatusUI::setValue(QString name,QVariant value)
|
||||
{
|
||||
switch (pos) {
|
||||
case 1:
|
||||
ui->label_FlightMode->setText(value1.toString());
|
||||
break;
|
||||
case 2:
|
||||
//ui->label_VerticalMode->setText(value1.toString());
|
||||
//ui->label_HorizonMode->setText(value2.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void StatusUI::setState(uint32_t pos, QVariant value1, QVariant value2)
|
||||
{
|
||||
switch (pos) {
|
||||
case 1:
|
||||
ui->label_1_Atteck->setText(value1.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) >= 20)
|
||||
{
|
||||
// setColor(ui->label_1_Atteck,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_Atteck,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
ui->label_1_Slide->setText(value1.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) >= 20)
|
||||
{
|
||||
// setColor(ui->label_1_Slide,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_Slide,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3:
|
||||
ui->label_1_rol->setText(value1.toString());
|
||||
//ui->label_2_rol->setText(value2.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) >= 45)
|
||||
{
|
||||
// setColor(ui->label_1_rol,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_rol,state::inital);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 4:
|
||||
ui->label_1_pit->setText(value1.toString());
|
||||
//ui->label_2_pit->setText(value2.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) >= 25)
|
||||
{
|
||||
// setColor(ui->label_1_pit,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_pit,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 5:
|
||||
ui->label_1_heading->setText(value1.toString());
|
||||
//ui->label_2_heading->setText(value2.toString());
|
||||
|
||||
break;
|
||||
case 6:
|
||||
ui->label_1_alt->setText(value1.toString());
|
||||
//ui->label_2_alt->setText(value2.toString());
|
||||
break;
|
||||
case 7:
|
||||
ui->label_1_cas->setText(value1.toString());
|
||||
|
||||
if(value1.toFloat() <= 22)
|
||||
{
|
||||
// setColor(ui->label_1_cas,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_cas,state::inital);
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
ui->label_1_tas->setText(value1.toString());
|
||||
//ui->label_2_tas->setText(value2.toString());
|
||||
|
||||
if(value1.toFloat() <= 22)
|
||||
{
|
||||
// setColor(ui->label_1_tas,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_tas,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 9:
|
||||
ui->label_1_gs->setText(value1.toString());
|
||||
|
||||
if(value1.toFloat() <= 22)
|
||||
{
|
||||
// setColor(ui->label_1_gs,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_gs,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 10:
|
||||
ui->label_1_ma->setText(value1.toString());
|
||||
|
||||
break;
|
||||
case 11:
|
||||
ui->label_1_rate->setText(value1.toString());
|
||||
|
||||
if(value1.toFloat() <= -30)
|
||||
{
|
||||
// setColor(ui->label_1_rate,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_1_rate,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 12:
|
||||
ui->label_gps_dir->setText(value1.toString());
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void StatusUI::setServo(uint32_t pos,QVariant real,QVariant meas)
|
||||
{
|
||||
switch (pos) {
|
||||
|
||||
case 1:
|
||||
ui->label_la_real->setText(real.toString());
|
||||
//ui->label_la_target->setText(meas.toString());
|
||||
break;
|
||||
case 2:
|
||||
ui->label_ra_real->setText(real.toString());
|
||||
//ui->label_ra_target->setText(meas.toString());
|
||||
break;
|
||||
case 3:
|
||||
ui->label_ele_real->setText(real.toString());
|
||||
//ui->label_lv_target->setText(meas.toString());
|
||||
break;
|
||||
case 4:
|
||||
ui->label_Hstable_real->setText(real.toString());
|
||||
//ui->label_rv_target->setText(meas.toString());
|
||||
break;
|
||||
case 5:
|
||||
//ui->label_rud_real->setText(real.toString());
|
||||
//ui->label_rud_target->setText(meas.toString());
|
||||
break;
|
||||
case 6:
|
||||
//ui->label_flap_real->setText(real.toString());
|
||||
//ui->label_rud_target->setText(meas.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void StatusUI::setRotor(uint32_t pos,QVariant value1,QVariant value2)
|
||||
{
|
||||
/*
|
||||
Q_UNUSED(value2)
|
||||
|
||||
switch (pos) {
|
||||
|
||||
case 1:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_1->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_1->setValue(value1.toInt());
|
||||
break;
|
||||
case 2:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_2->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_2->setValue(value1.toInt());
|
||||
break;
|
||||
case 3:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_3->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_3->setValue(value1.toInt());
|
||||
break;
|
||||
case 4:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_4->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_4->setValue(value1.toInt());
|
||||
break;
|
||||
case 5:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_5->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_5->setValue(value1.toInt());
|
||||
break;
|
||||
case 6:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_6->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_6->setValue(value1.toInt());
|
||||
break;
|
||||
case 7:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_7->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_7->setValue(value1.toInt());
|
||||
break;
|
||||
case 8:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_8->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_8->setValue(value1.toInt());
|
||||
break;
|
||||
case 9:
|
||||
if(value1.toInt() >= 8000)
|
||||
{
|
||||
ui->progressBar_rotor_9->setRange(0,value1.toInt());
|
||||
}
|
||||
|
||||
ui->progressBar_rotor_9->setValue(value1.toInt());
|
||||
break;
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void StatusUI::setEngine(uint32_t pos,QVariant value)
|
||||
{
|
||||
switch (pos) {
|
||||
case 1:
|
||||
|
||||
if(value.toInt() >= 100)
|
||||
{
|
||||
ui->label_throttle->setRange(0,value.toInt());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(value.toInt() <= 0)
|
||||
{
|
||||
ui->label_throttle->setRange(value.toInt(),100);
|
||||
}
|
||||
else if(value.toInt() >= 100)
|
||||
{
|
||||
ui->label_throttle->setRange(0,value.toInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->label_throttle->setRange(0,100);
|
||||
}
|
||||
|
||||
ui->label_throttle->setValue(value.toInt());
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
ui->label_rpm->setText(value.toString());
|
||||
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
ui->label_T0->setText(value.toString());
|
||||
|
||||
break;
|
||||
case 4:
|
||||
|
||||
ui->label_P5->setText(value.toString());
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
ui->label_servo_current->setText(value.toString());
|
||||
|
||||
break;
|
||||
case 6:
|
||||
|
||||
ui->label_engine_check->setText(value.toString());
|
||||
|
||||
break;
|
||||
|
||||
case 7:
|
||||
ui->label_EngineState->setText(value.toString());
|
||||
|
||||
break;
|
||||
case 8:
|
||||
|
||||
ui->label_Parachute->setText(value.toString());
|
||||
|
||||
break;
|
||||
case 9:
|
||||
|
||||
ui->label_flux->setText(value.toString());
|
||||
|
||||
break;
|
||||
case 10:
|
||||
|
||||
ui->label_Fuel_Int->setText(value.toString());
|
||||
|
||||
break;
|
||||
case 11:
|
||||
|
||||
ui->label_Fuel_Est->setText(value.toString());
|
||||
|
||||
break;
|
||||
|
||||
if(StateList.keys().contains(name))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void StatusUI::setBattery(uint32_t pos,QVariant value1,QVariant value2)
|
||||
{
|
||||
switch (pos) {
|
||||
case 1:
|
||||
ui->label_bat_1->setText(value1.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) <= 10.5)
|
||||
{
|
||||
// setColor(ui->label_bat_1,state::failure);
|
||||
}
|
||||
else if(qAbs(value1.toFloat()) <= 11.4)
|
||||
{
|
||||
// setColor(ui->label_bat_1,state::warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_bat_1,state::inital);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
ui->label_bat_2->setText(value1.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) <= 82)
|
||||
{
|
||||
// setColor(ui->label_bat_2,state::failure);
|
||||
}
|
||||
else if(qAbs(value1.toFloat()) <= 88)
|
||||
{
|
||||
// setColor(ui->label_bat_2,state::warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_bat_2,state::inital);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
ui->label_bat_3->setText(value1.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) <= 82)
|
||||
{
|
||||
// setColor(ui->label_bat_3,state::failure);
|
||||
}
|
||||
else if(qAbs(value1.toFloat()) <= 88){
|
||||
// setColor(ui->label_bat_3,state::warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_bat_3,state::inital);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
ui->label_BackFuel->setText(value1.toString());
|
||||
|
||||
break;
|
||||
case 5:
|
||||
ui->label_EngineVol->setText(value1.toString());
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void StatusUI::setDlink(uint32_t pos,QVariant value1,QVariant value2)
|
||||
{
|
||||
switch (pos) {
|
||||
case 1:
|
||||
|
||||
|
||||
ui->label_ssp->setText(value1.toString());
|
||||
|
||||
if(qAbs(value1.toFloat()) <= 50)
|
||||
{
|
||||
// setColor(ui->label_ssp,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
// setColor(ui->label_ssp,state::inital);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui->label_ssr->setText(value2.toString());
|
||||
|
||||
if(qAbs(value2.toFloat()) <= 200)
|
||||
{
|
||||
//setColor(ui->label_ssr,state::failure);
|
||||
}
|
||||
else
|
||||
{
|
||||
//setColor(ui->label_ssr,state::inital);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void StatusUI::install(QString group,QString name,double min,double max)
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user