Nakuja Flight Computer Testing and Simulation Engine (NaFCTSE) 1.0
A testing and verification tool for the Nakuja Rocket Project flight computers
Loading...
Searching...
No Matches
mainwindow.h
1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H
3
4#include <QMainWindow>
5#include <QString>
6#include "serialport.h"
7#include "serialparser.h"
8#include <QTimer>
9
10QT_BEGIN_NAMESPACE
11namespace Ui {
12class MainWindow;
13}
14QT_END_NAMESPACE
15
16class MainWindow : public QMainWindow
17{
18 Q_OBJECT
19
20public:
21 MainWindow(QWidget *parent = nullptr);
22 int SERIAL_BUFF_LENGTH = 256;
23 QString activeStateStyle = "QLabel { background-color : black; color : #00FF00; border: 1px solid gray; border-radius: 4px; font: 700 9pt; }";
25 void setStaticUI();
26
27private slots:
28 // serial monitor functions
29 void updateSerialMonitor(const QString data);
30 void readData(const QString data);
31
32 // button press handlers
33 void on_btnChooseFile_clicked();
34 void on_connectSerial_clicked();
35 void on_writeSerialButton_clicked();
36 void on_closeSerialButton_clicked();
37 void on_btnLink_clicked();
38 void on_btnCheckSystems_clicked();
39 void on_btnConfirmCheck_clicked();
40
41 // update UI functions
42 void updateFlightStateUI(QString);
43 void updateSystemDiagnosticsUI(QString);
44 void updateSubSystemsPeriodic();
45
46 // EOT slots
47 void handleEndOfTransmission();
48
49 // subsystems check slot
50 void handleSubsystemsCheck();
51 void handleStateReceive();
52
53 // graphing capabilities
54 void plotAltitude(QVector<double>*, int);
55
56 void systemsCheck(QString);
57 void resetStatesLabels();
58
59 void on_btnMainRun_clicked();
60
61signals:
62 void endOfTransmissionSignal(); // to check for End of Transmission signal from DUT
63 void subsystemsInitCheckSignal(); // to check for subsystems
64 void preflightRCVDSignal();
65 void poweredFlightRCVDSignal();
66 void apogeeRCVDSignal();
67
68private:
69 Ui::MainWindow *ui;
70 static constexpr uint8_t numBaudRates = 9;
71 uint64_t baudRates[9];
72 static constexpr uint64_t numTimeSteps = 8;
73 SerialPort port;
74 bool isConnected = false;
75 SerialParser parser;
76 QTimer* mSerialScanTimer; // to scan the serial ports periodically
77 void loadPorts();
78 void updateSerialPorts();
79
80 QTimer* updateSubSystemsTimer;
81
82 // test
83 // order -> imu, altimeter, gps, comms, flash, test-flash, power
84 static constexpr int num_sub_systems = 8;
85 int sys_diag[num_sub_systems] = {1,1,1,1,0,1,0};
86
87};
88#endif // MAINWINDOW_H
MainWindow(QWidget *parent=nullptr)
MainWindow::MainWindow.
Definition mainwindow.cpp:33
~MainWindow()
MainWindow::~MainWindow Destructor.
Definition mainwindow.cpp:733
Definition serialparser.h:15
Definition serialport.h:9