Files
gcs-nf/App/mainwindow.h
T

259 lines
5.5 KiB
C++
Raw Normal View History

2022-09-15 09:07:38 +08:00
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
2020-08-07 17:15:58 +08:00
#include "QApplication"
2020-10-06 09:34:04 +08:00
#include "Config/Config.h"
#include "Cockpit.h"
#include "mavlinknode.h"
#include "QThread"
#include "opmapwidget.h"
#include "Cockpit.h"
#include "dlink.h"
#include "skin.h"
2020-10-08 17:32:13 +08:00
#include "StatusUI/StatusUI.h"
2020-03-25 13:01:49 +08:00
#include "InspectUI/InspectUI.h"
2020-03-28 21:27:22 +08:00
#include "ToolsUI/ToolsUI.h"
2020-10-10 20:22:04 +08:00
#include "HealthUI/HealthUI.h"
#include "pureprojection.h"
2020-03-28 21:27:22 +08:00
//sub widget
#include "About/About.h"
#include "Help/Help.h"
#include "Setting/Setting.h"
2020-03-25 12:42:26 +08:00
2020-08-07 17:15:58 +08:00
#include "QTextToSpeech"
//cmd ui
#include "QQuickWidget"
#include "QQuickView"
2020-04-30 17:29:57 +08:00
#include "CommandUI/CommandUI.h"
2020-04-10 15:46:03 +08:00
2020-04-30 17:29:57 +08:00
//mission ui
2020-05-08 17:03:58 +08:00
#include "MissionUI/propertyui.h"
2020-04-30 17:29:57 +08:00
//menubar ui
#include "MenuBarUI/MenuBarUI.h"
2020-04-10 15:46:03 +08:00
2020-05-15 18:47:47 +08:00
//selfcheck
#include "CheckUI/CheckUI.h"
2020-04-09 20:19:56 +08:00
QT_BEGIN_MOC_NAMESPACE
2020-09-28 17:05:51 +08:00
//#pragma execution_character_set("utf-8")
class MainWindow : public QMainWindow
{
Q_OBJECT
2021-06-27 18:25:22 +08:00
typedef struct
{
double d0;
double kd;
double le;
}_servo;
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
2023-04-07 15:23:30 +08:00
/**
* @brief 显示变体舵机信息
* @param var
*/
void showVariantInfo(Variant const &var);
2020-06-29 18:03:28 +08:00
void showMessage(const QString &message,int TimeOut = 0);
2020-06-28 18:43:03 +08:00
2020-10-12 21:08:37 +08:00
void setCommunicationLostState(bool flag);
2020-08-07 17:15:58 +08:00
void setBeep(QVariant state);
2021-01-09 12:20:44 +08:00
void beep(int sysid);
2020-08-07 17:15:58 +08:00
2021-05-13 09:17:59 +08:00
void setTTS(QVariant state);
2020-12-08 22:21:52 +08:00
2021-06-27 18:25:22 +08:00
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);
2020-12-08 22:21:52 +08:00
2022-02-25 15:51:18 +08:00
void setMargin(int type, QMap<int,Config::_latlng> latlng,QColor color);
2022-02-11 14:10:16 +08:00
2022-08-19 22:08:04 +08:00
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);
2022-08-24 11:51:28 +08:00
void actuator_info_brake(Parse::_actuator info);
2022-08-19 22:08:04 +08:00
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);
2022-09-15 09:07:38 +08:00
void onTabIndexChanged(const int &index);
2022-08-19 22:08:04 +08:00
void RTCM_Byte(uint32_t count);
void RC_Byte(uint32_t count);
2020-04-13 21:37:30 +08:00
protected slots:
2020-05-06 19:17:40 +08:00
bool event(QEvent *event);
void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *event);
2020-04-13 21:37:30 +08:00
void mousePressEvent(QMouseEvent* event);
void keyPressEvent(QKeyEvent *event);
2020-08-11 16:48:15 +08:00
//void mouseMoveEvent();
2020-03-28 21:27:22 +08:00
private slots:
2021-11-11 15:00:56 +08:00
void updateVehicle(MavLinkNode::_vehicle vehicle);
2020-07-15 18:00:02 +08:00
void TotalDistance(double value);
2020-04-10 15:46:03 +08:00
void Timer_1s_out(void);
2021-04-28 15:39:44 +08:00
void updateDlink(float rssi, uint64_t in, uint64_t out);
void dlinkinfo(double rssi,double in,double out);
2020-12-26 15:17:45 +08:00
2022-08-30 16:33:30 +08:00
void update_servo_output_raw(int sysid, mavlink_servo_output_raw_t servo);
2020-12-26 15:17:45 +08:00
2021-10-11 09:42:42 +08:00
void ins1_Update(mavlink_ins1_t ins);
void ins2_Update(mavlink_ins2_t ins);
void TTSsay(QString str);
2020-04-10 15:46:03 +08:00
protected slots:
2022-07-20 18:28:26 +08:00
signals:
2020-08-12 22:12:44 +08:00
2022-07-23 10:59:04 +08:00
void setECUTemp(qreal temp,qreal pressure);
void setBat(quint16 value[10]);
2020-04-10 15:46:03 +08:00
protected:
2020-07-10 18:05:15 +08:00
int MainIndex = 0;
2020-10-06 09:34:04 +08:00
Config *config = nullptr;
2020-07-10 18:05:15 +08:00
2020-10-08 17:32:13 +08:00
StatusUI *statusui = nullptr;
2020-10-10 20:22:04 +08:00
HealthUI *healthui = nullptr;
2020-04-30 17:29:57 +08:00
MenuBarUI *menuBarUI = nullptr;
CommandUI *commandUI = nullptr;
Cockpit *copk = nullptr;
2020-05-15 18:47:47 +08:00
CheckUI *checkUI = nullptr;
2020-05-08 17:03:58 +08:00
propertyui *missionUI = nullptr;
2020-04-30 17:29:57 +08:00
mapcontrol::OPMapWidget *map = nullptr;
DLink *dlink = nullptr;
2020-05-28 18:11:23 +08:00
ToolsUI *toolsui = nullptr;
2020-03-25 12:42:26 +08:00
2020-03-28 21:27:22 +08:00
Setting *setting = nullptr;
2020-03-25 12:42:26 +08:00
QQuickWidget *quick = nullptr;
2020-03-25 12:42:26 +08:00
2020-08-11 16:48:15 +08:00
QTimer *updateTimer = nullptr;
2020-08-12 22:12:44 +08:00
QTextToSpeech *tts = nullptr;
2020-06-29 18:03:28 +08:00
bool isCommunicationLost = true;
internals::PointLatLng StartPoint;
QTimer *Timer_1s = nullptr;
QDateTime *FlightTime = nullptr;
QDateTime *StartupTime = nullptr;
bool isEngineStartUp = false;
bool isEnableBeep = true;
2021-05-13 09:17:59 +08:00
bool isEnableTTS = true;
2020-12-08 22:21:52 +08:00
float m_la = 0;
float m_ra = 0;
float m_le = 0;
float m_re = 0;
float m_ru = 0;
2021-01-26 20:06:35 +08:00
double fuelTotal = 349;
2020-12-28 13:04:31 +08:00
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}};
2021-01-17 21:44:41 +08:00
QMap<uint16_t,double> table_flux = {{1277,23},{1499,0},{1728,-27}};
2020-12-28 13:04:31 +08:00
2021-06-27 18:25:22 +08:00
_servo ch1;
_servo ch2;
_servo ch3;
_servo ch4;
_servo ch5;
_servo ch6;
_servo ch7;
_servo ch8;
2022-08-30 16:33:30 +08:00
uint32_t health;
uint32_t enabled;
uint32_t present;
2022-09-28 16:19:36 +08:00
qreal Ma = 0;
};
#endif // MAINWINDOW_H