Skip to content

Commit

Permalink
Pilot page
Browse files Browse the repository at this point in the history
Added pilot page
Need help from joão to fix it
  • Loading branch information
bruno3634-gif committed Aug 18, 2024
1 parent 56e446c commit 52e4cde
Show file tree
Hide file tree
Showing 9 changed files with 291 additions and 50 deletions.
10 changes: 7 additions & 3 deletions LukHudX.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifdef __LART_DEBUG__
#include "voidsterdebugwindow.h"
#include "voidsterdebugwindow2.h"
#include "mainwindow.h"
#else
#include "mainwindow.h"
#endif
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ MainWindow::MainWindow(QWidget *parent, QString serialDev)


#endif
connect(store_ref, &store::engineTemperatureChanged,EngineTemperature_Label,(void(FLabel::*)(int,int))&FLabel::setVisual);
}


Expand Down
68 changes: 68 additions & 0 deletions src/pilot.cpp
Original file line number Diff line number Diff line change
@@ -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 <cstddef>
#include <qmainwindow.h>
#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<QLCDNumber*>("SPEED_DISPLAY");
connect(store_ref, &store::rpmChanged, SPEED_DISPLAY, (void (QLCDNumber::*)(short, short))&QLCDNumber::setAveragedVisualChangeSec);

}




/**
* @brief A getter for a store pointer. <b> use with caution, </b>
* <em> with great power comes great *frickery... This function is by reference and should be used for startup stuff</em>
* @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;
}
29 changes: 29 additions & 0 deletions src/pilot.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef PILOT_H
#define PILOT_H



#include <QMainWindow>
#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
133 changes: 133 additions & 0 deletions src/pilot.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>672</width>
<height>465</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLCDNumber" name="SPEED_DISPLAY">
<property name="geometry">
<rect>
<x>170</x>
<y>260</y>
<width>211</width>
<height>171</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="Km_H_LABEL">
<property name="geometry">
<rect>
<x>390</x>
<y>290</y>
<width>221</width>
<height>161</height>
</rect>
</property>
<property name="text">
<string>Km/h</string>
</property>
</widget>
<widget class="QProgressBar" name="HV_SOC_BAR">
<property name="geometry">
<rect>
<x>80</x>
<y>20</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QProgressBar" name="LV_SOC_BAR">
<property name="geometry">
<rect>
<x>240</x>
<y>20</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QLabel" name="HV_SOC_LABEL">
<property name="geometry">
<rect>
<x>110</x>
<y>0</y>
<width>67</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>SOC HV</string>
</property>
</widget>
<widget class="QLabel" name="LV_SOC_LABEL">
<property name="geometry">
<rect>
<x>270</x>
<y>0</y>
<width>67</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>SOC LV</string>
</property>
</widget>
<widget class="QProgressBar" name="POWER_SOC_BAR">
<property name="geometry">
<rect>
<x>410</x>
<y>20</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
<widget class="QLabel" name="MAXPOWER_LABEL">
<property name="geometry">
<rect>
<x>420</x>
<y>0</y>
<width>91</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>MAX POWER</string>
</property>
</widget>
<widget class="QLCDNumber" name="TEMP_DISPLAY">
<property name="geometry">
<rect>
<x>40</x>
<y>130</y>
<width>201</width>
<height>91</height>
</rect>
</property>
<property name="intValue" stdset="0">
<number>0</number>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
4 changes: 4 additions & 0 deletions src/references/pilot.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef PILOT_H
#define PILOT_H

#endif // PILOT_H
2 changes: 1 addition & 1 deletion src/voidsterdebugwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ VoidsterdebugWindow::VoidsterdebugWindow(QWidget *parent, QString serialDev)
TelemetryValue_Label->setText("TV");
Telemetry_Label->setText("TL");
Driverless_Label->setText("DL");
*/

Expand Down
Loading

0 comments on commit 52e4cde

Please sign in to comment.