254 lines
5.4 KiB
C++
254 lines
5.4 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include "QApplication"
|
|
|
|
|
|
#include "Config/Config.h"
|
|
|
|
#include "Cockpit.h"
|
|
|
|
|
|
#include "mavlinknode.h"
|
|
|
|
#include "QThread"
|
|
|
|
#include "opmapwidget.h"
|
|
#include "Cockpit.h"
|
|
#include "dlink.h"
|
|
#include "skin.h"
|
|
|
|
#include "StatusUI/StatusUI.h"
|
|
#include "InspectUI/InspectUI.h"
|
|
#include "ToolsUI/ToolsUI.h"
|
|
#include "HealthUI/HealthUI.h"
|
|
#include "pureprojection.h"
|
|
|
|
//sub widget
|
|
#include "About/About.h"
|
|
#include "Help/Help.h"
|
|
#include "Setting/Setting.h"
|
|
|
|
#include "QTextToSpeech"
|
|
|
|
|
|
//cmd ui
|
|
#include "QQuickWidget"
|
|
#include "QQuickView"
|
|
|
|
#include "CommandUI/CommandUI.h"
|
|
|
|
|
|
//mission ui
|
|
#include "MissionUI/propertyui.h"
|
|
|
|
//menubar ui
|
|
#include "MenuBarUI/MenuBarUI.h"
|
|
|
|
|
|
|
|
//selfcheck
|
|
#include "CheckUI/CheckUI.h"
|
|
|
|
|
|
QT_BEGIN_MOC_NAMESPACE
|
|
|
|
//#pragma execution_character_set("utf-8")
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
typedef struct
|
|
{
|
|
double d0;
|
|
double kd;
|
|
double le;
|
|
}_servo;
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
|
|
|
|
public slots:
|
|
void showMessage(const QString &message,int TimeOut = 0);
|
|
|
|
void setCommunicationLostState(bool flag);
|
|
|
|
void setBeep(QVariant state);
|
|
void beep(int sysid);
|
|
|
|
void setTTS(QVariant state);
|
|
|
|
|
|
void setServoOffset(QVariant ch1_d0,QVariant ch1_kd,QVariant ch1_len,
|
|
QVariant ch2_d0,QVariant ch2_kd,QVariant ch2_len,
|
|
QVariant ch3_d0,QVariant ch3_kd,QVariant ch3_len,
|
|
QVariant ch4_d0,QVariant ch4_kd,QVariant ch4_len,
|
|
QVariant ch5_d0,QVariant ch5_kd,QVariant ch5_len,
|
|
QVariant ch6_d0,QVariant ch6_kd,QVariant ch6_len,
|
|
QVariant ch7_d0,QVariant ch7_kd,QVariant ch7_len,
|
|
QVariant ch8_d0,QVariant ch8_kd,QVariant ch8_len);
|
|
|
|
void setMargin(int type, QMap<int,Config::_latlng> latlng,QColor color);
|
|
|
|
|
|
|
|
void INS_Info(Parse::_ins info);
|
|
void NAV_Info(Parse::_nav info);
|
|
void gear_Info(Parse::_gear info);
|
|
|
|
|
|
void EADC_Info(Parse::_eadc info);
|
|
void ECU_Info(Parse::_ecu info);
|
|
void SSPC_Info(Parse::_sspc info);
|
|
|
|
|
|
void actuator_info(Parse::_actuator info);
|
|
void actuator_info_brake(Parse::_actuator info);
|
|
void actuator1_info(Parse::_actuator1 info);
|
|
void actuator2_info(Parse::_actuator2 info);
|
|
|
|
void imu_info(Parse::_imu info);
|
|
void euler_info(Parse::_euler info);
|
|
void vel_info(Parse::_vel info);
|
|
void pos_info(Parse::_pos info);
|
|
|
|
void SSPC_Info_state(Parse::_sspc info);
|
|
|
|
void onTabIndexChanged(const int &index);
|
|
|
|
|
|
void RTCM_Byte(uint32_t count);
|
|
void RC_Byte(uint32_t count);
|
|
|
|
|
|
protected slots:
|
|
|
|
bool event(QEvent *event);
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
void resizeEvent(QResizeEvent *event);
|
|
void mousePressEvent(QMouseEvent* event);
|
|
void keyPressEvent(QKeyEvent *event);
|
|
//void mouseMoveEvent();
|
|
|
|
private slots:
|
|
|
|
void updateVehicle(MavLinkNode::_vehicle vehicle);
|
|
|
|
void TotalDistance(double value);
|
|
|
|
|
|
void Timer_1s_out(void);
|
|
|
|
|
|
void updateDlink(float rssi, uint64_t in, uint64_t out);
|
|
void dlinkinfo(double rssi,double in,double out);
|
|
|
|
void update_servo_output_raw(int sysid, mavlink_servo_output_raw_t servo);
|
|
|
|
|
|
void ins1_Update(mavlink_ins1_t ins);
|
|
void ins2_Update(mavlink_ins2_t ins);
|
|
|
|
void TTSsay(QString str);
|
|
|
|
protected slots:
|
|
|
|
signals:
|
|
|
|
void setECUTemp(qreal temp,qreal pressure);
|
|
|
|
void setBat(quint16 value[10]);
|
|
|
|
protected:
|
|
|
|
int MainIndex = 0;
|
|
|
|
Config *config = nullptr;
|
|
|
|
StatusUI *statusui = nullptr;
|
|
HealthUI *healthui = nullptr;
|
|
MenuBarUI *menuBarUI = nullptr;
|
|
CommandUI *commandUI = nullptr;
|
|
Cockpit *copk = nullptr;
|
|
CheckUI *checkUI = nullptr;
|
|
propertyui *missionUI = nullptr;
|
|
|
|
mapcontrol::OPMapWidget *map = nullptr;
|
|
|
|
DLink *dlink = nullptr;
|
|
|
|
ToolsUI *toolsui = nullptr;
|
|
|
|
Setting *setting = nullptr;
|
|
|
|
|
|
QQuickWidget *quick = nullptr;
|
|
|
|
QTimer *updateTimer = nullptr;
|
|
|
|
QTextToSpeech *tts = nullptr;
|
|
|
|
|
|
bool isCommunicationLost = true;
|
|
|
|
|
|
internals::PointLatLng StartPoint;
|
|
|
|
QTimer *Timer_1s = nullptr;
|
|
|
|
QDateTime *FlightTime = nullptr;
|
|
QDateTime *StartupTime = nullptr;
|
|
|
|
bool isEngineStartUp = false;
|
|
|
|
bool isEnableBeep = true;
|
|
bool isEnableTTS = true;
|
|
|
|
float m_la = 0;
|
|
float m_ra = 0;
|
|
float m_le = 0;
|
|
float m_re = 0;
|
|
float m_ru = 0;
|
|
|
|
double fuelTotal = 349;
|
|
|
|
QMap<int,uint16_t> servos;
|
|
|
|
QMap<uint16_t,double> table_lail = {{1218,20},{1505,0},{2032,-30}};
|
|
QMap<uint16_t,double> table_rail = {{1145,-30},{1502,0},{1764,20}};
|
|
QMap<uint16_t,double> table_ele = {{1154,25.3},{1499,0},{1845,-25.7}};
|
|
QMap<uint16_t,double> table_tail = {{1353,-5.2},{1459,-3},{1598,0},{1768,2.5},{1936,4}};
|
|
QMap<uint16_t,double> table_rud = {{1277,23},{1499,0},{1728,-27}};
|
|
|
|
QMap<uint16_t,double> table_flux = {{1277,23},{1499,0},{1728,-27}};
|
|
|
|
|
|
_servo ch1;
|
|
_servo ch2;
|
|
_servo ch3;
|
|
_servo ch4;
|
|
_servo ch5;
|
|
_servo ch6;
|
|
_servo ch7;
|
|
_servo ch8;
|
|
|
|
|
|
uint32_t health;
|
|
uint32_t enabled;
|
|
uint32_t present;
|
|
|
|
qreal Ma = 0;
|
|
|
|
|
|
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|