diff --git a/LukHudX.pro b/LukHudX.pro index 08c7942..0fa6059 100644 --- a/LukHudX.pro +++ b/LukHudX.pro @@ -27,12 +27,13 @@ RCC_DIR = build # Input HEADERS += \ #Constants Macros Aux stuff + src/mainwindow.h \ + src/pilot.h \ src/references/bson_var.h \ #UI and other non operational stuff src/flabel.h \ src/contarotacoes.h \ src/contamudancas.h \ - src/mainwindow.h \ src/tfortwindow.h\ src/voidsterdebugwindow.h \ src/voidsterdebugwindow2.h \ @@ -48,14 +49,17 @@ SOURCES += \ src/contarotacoes.cpp \ src/contamudancas.cpp \ src/main.cpp \ - src/mainwindow.cpp \ #Biz Logic + src/mainwindow.cpp \ + src/pilot.cpp \ src/store.cpp \ src/tfortwindow.cpp \ src/voidsterdebugwindow.cpp \ src/voidsterdebugwindow2.cpp -FORMS += src/mainwindow.ui \ +FORMS += \ + src/mainwindow.ui \ + src/pilot.ui \ src/tfortwindow.ui \ src/voidsterdebugwindow.ui \ src/voidsterdebugwindow2.ui diff --git a/src/main.cpp b/src/main.cpp index e0cb80a..ef12fce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -13,6 +13,7 @@ #ifdef __LART_DEBUG__ #include "voidsterdebugwindow.h" #include "voidsterdebugwindow2.h" +#include "mainwindow.h" #else #include "mainwindow.h" #endif @@ -45,8 +46,10 @@ int main(int argc, char *argv[]){ - VoidsterdebugWindow2 debugWindow2; - debugWindow2.show(); + //VoidsterdebugWindow2 debugWindow2; + //debugWindow2.show(); + MainWindow w; + w.show(); #else MainWindow w; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 39c4223..ab292ed 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -62,7 +62,7 @@ MainWindow::MainWindow(QWidget *parent, QString serialDev) #endif - + connect(store_ref, &store::engineTemperatureChanged,EngineTemperature_Label,(void(FLabel::*)(int,int))&FLabel::setVisual); } diff --git a/src/pilot.cpp b/src/pilot.cpp new file mode 100644 index 0000000..5861cba --- /dev/null +++ b/src/pilot.cpp @@ -0,0 +1,68 @@ +/** +* @file pilot.cpp +* @brief This file contains the logic for the PilotWindow class +* @see pilot.h +* @see store.h +* @see flabel.h +* @author Bruno Vicente +* This piece of software was developed for the T24e project belonging to the LART Team +**/ + +#include "pilot.h" +#include "./ui_voidsterdebugwindow.h" + +#include "./store.h" +#include +#include +#include "flabel.h" +#include "QLCDNumber" +static store* store_ref; + + + +/** +* @brief Constructor for the VoidsterdebugWindow Class. +* @b Connects @b **most** variables from the store to the FLabels on the screen. +**/ +PilotWindow::PilotWindow(QWidget *parent, QString serialDev) + : QMainWindow(parent) + , ui(new Ui::~PilotWindow){ + + store_ref = new store(serialDev); + + ui->setupUi(this); + //store_ref->setParent(this); + //store_ref->requestSlotAttachment(); + + /** + * @brief bellow is the spaggeti code thats preprocessed to permit portable use between vehicles + * The magic occurs in qmake through the DEFINES variable. + * @see bson_var.h + **/ + + + #ifdef __LART_T24__ + QLCDNumber* SPEED_DISPLAY = this->findChild("SPEED_DISPLAY"); + connect(store_ref, &store::rpmChanged, SPEED_DISPLAY, (void (QLCDNumber::*)(short, short))&QLCDNumber::setAveragedVisualChangeSec); + +} + + + + +/** +* @brief A getter for a store pointer. use with caution, +* with great power comes great *frickery... This function is by reference and should be used for startup stuff +* @returns a pointer to the store object +**/ +store* PilotWindow::getStore(){ + return store_ref; +} +/** +* @brief Destructor for the VoidsterdebugWindow Class. +* @b Deletes the store object. which can cause some odd behaviour to happen +**/ +PilotWindow::~PilotWindow(){ + store_ref->~store(); + delete ui; +} diff --git a/src/pilot.h b/src/pilot.h new file mode 100644 index 0000000..b698ded --- /dev/null +++ b/src/pilot.h @@ -0,0 +1,29 @@ +#ifndef PILOT_H +#define PILOT_H + + + +#include +#include "store.h" + + +QT_BEGIN_NAMESPACE +namespace Ui { class PilotWindow; } +QT_END_NAMESPACE + +class PilotWindow : public QMainWindow +{ + Q_OBJECT + +public: + PilotWindow(QWidget *parent = nullptr, QString serialDev=nullptr); + store* getStore(); + ~PilotWindow(); + +private: + + Ui::PilotWindow *ui; +}; + + +#endif // PILOT_H diff --git a/src/pilot.ui b/src/pilot.ui new file mode 100644 index 0000000..1c6cc27 --- /dev/null +++ b/src/pilot.ui @@ -0,0 +1,133 @@ + + + Form + + + + 0 + 0 + 672 + 465 + + + + Form + + + + + 170 + 260 + 211 + 171 + + + + + + + 390 + 290 + 221 + 161 + + + + Km/h + + + + + + 80 + 20 + 118 + 23 + + + + 24 + + + + + + 240 + 20 + 118 + 23 + + + + 24 + + + + + + 110 + 0 + 67 + 17 + + + + SOC HV + + + + + + 270 + 0 + 67 + 17 + + + + SOC LV + + + + + + 410 + 20 + 118 + 23 + + + + 10 + + + + + + 420 + 0 + 91 + 17 + + + + MAX POWER + + + + + + 40 + 130 + 201 + 91 + + + + 0 + + + + + + diff --git a/src/references/pilot.h b/src/references/pilot.h new file mode 100644 index 0000000..3c742d8 --- /dev/null +++ b/src/references/pilot.h @@ -0,0 +1,4 @@ +#ifndef PILOT_H +#define PILOT_H + +#endif // PILOT_H diff --git a/src/voidsterdebugwindow.cpp b/src/voidsterdebugwindow.cpp index 064c0e7..8abae1d 100644 --- a/src/voidsterdebugwindow.cpp +++ b/src/voidsterdebugwindow.cpp @@ -85,7 +85,7 @@ VoidsterdebugWindow::VoidsterdebugWindow(QWidget *parent, QString serialDev) TelemetryValue_Label->setText("TV"); Telemetry_Label->setText("TL"); - + Driverless_Label->setText("DL"); */ diff --git a/src/voidsterdebugwindow.ui b/src/voidsterdebugwindow.ui index a50fc46..a482097 100644 --- a/src/voidsterdebugwindow.ui +++ b/src/voidsterdebugwindow.ui @@ -7,7 +7,7 @@ 0 0 668 - 489 + 515 @@ -490,35 +490,29 @@ QLayout::SetDefaultConstraint - - + + - 55320 / 44300 W (-1%/s) - - - false - - - -1 + SOC(%): - - + + - 50% (5 hours of juice left) + Limit: 80.000 - - + + - 620 V (+5%) + Enabled DT Constraints - - + + Qt::Vertical @@ -530,10 +524,10 @@ - - + + - Inverter Voltage: + 50% (5 hours of juice left) @@ -550,10 +544,30 @@ - - + + - Enabled DT Constraints + 620 V (+5%) + + + + + + + Total Power Draw(Curr): + + + + + + + 55320 / 44300 W (-1%/s) + + + false + + + -1 @@ -570,22 +584,15 @@ - - - - Limit: 80.000 - - - - - + + - SOC(%): + Inverter Voltage: - - + + Qt::Vertical @@ -597,13 +604,6 @@ - - - - Total Power Draw(Curr): - - -