Skip to content

Commit

Permalink
Mete mais ganza nesta merda mete
Browse files Browse the repository at this point in the history
Caralhos fodam o drogado que abstraiu esta merda toda.

Devia apanhar com uma jante do t-24e nos cornos.
  • Loading branch information
bruno3634-gif committed Aug 19, 2024
1 parent 52e4cde commit 35724ae
Show file tree
Hide file tree
Showing 8 changed files with 453 additions and 42 deletions.
6 changes: 6 additions & 0 deletions src/flabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
FLabel::FLabel(QWidget *parent) : QLabel(parent){

}




/**
* @brief Handles the visual representation of a QString value
* @param newValue The new value, that will be displayed
Expand Down Expand Up @@ -97,3 +101,5 @@ void FLabel::setVisual(QTime newValue, QTime oldValue=QTime(0,0,0,0)){

this->setText(newValue.toString("mm:ss.zzz"));
}


15 changes: 9 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifdef __LART_T14__
#include "src/tfortwindow.h"
#endif

#include "pilot.h"
#ifdef __LART_T24__
#ifdef __LART_DEBUG__
#include "voidsterdebugwindow.h"
Expand Down Expand Up @@ -40,20 +40,23 @@ int main(int argc, char *argv[]){

#ifdef __LART_T24__
#ifdef __LART_DEBUG__

VoidsterdebugWindow debugWindow;
debugWindow.show();

// VoidsterdebugWindow debugWindow;
// debugWindow.show();

PilotWindow pl;
pl.show();


//VoidsterdebugWindow2 debugWindow2;
//debugWindow2.show();
MainWindow w;
w.show();
//MainWindow w;
//w.show();

#else
MainWindow w;
w.show();

#endif
#endif
#ifdef __LART_T14__
Expand Down
64 changes: 58 additions & 6 deletions src/pilot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
**/

#include "pilot.h"
#include "./ui_voidsterdebugwindow.h"
#include "./ui_pilot.h"

#include "./store.h"
#include <cstddef>
#include <qmainwindow.h>
#include "flabel.h"
#include "QLCDNumber"
#include "qprogressbar.h"
static store* store_ref;

#include "voidsterdebugwindow.h"


/**
Expand All @@ -26,11 +28,14 @@ static store* store_ref;
**/
PilotWindow::PilotWindow(QWidget *parent, QString serialDev)
: QMainWindow(parent)
, ui(new Ui::~PilotWindow){
, ui(new Ui::pilot) // This correctly matches the class name in the .ui file
{
ui->setupUi(this);
setWindowTitle("Pilotamos");


store_ref = new store(serialDev);

ui->setupUi(this);
//store_ref->setParent(this);
//store_ref->requestSlotAttachment();

Expand All @@ -41,10 +46,55 @@ PilotWindow::PilotWindow(QWidget *parent, QString serialDev)
**/


#ifdef __LART_T24__
QLCDNumber* SPEED_DISPLAY = this->findChild<QLCDNumber*>("SPEED_DISPLAY");
connect(store_ref, &store::rpmChanged, SPEED_DISPLAY, (void (QLCDNumber::*)(short, short))&QLCDNumber::setAveragedVisualChangeSec);
QLCDNumber* SPEED_DISPLAY = this->findChild<QLCDNumber*>("SPEED_DISPLAY");
QLCDNumber* INVERTER_TEMP_DISPLAY = this->findChild<QLCDNumber*>("INVERTER_TEMP_DISPLAY");
QLCDNumber* MOTOR_TEMP_DISPLAY = this->findChild<QLCDNumber*>("MOTOR_TEMP_DISPLAY");
QLCDNumber* ACUMULATOR_TEMP_DISPLAY = this->findChild<QLCDNumber*>("ACUMULATOR_TEMP_DISPLAY");


QProgressBar* HV_SOC_BAR = this->findChild<QProgressBar*>("HV_SOC_BAR");
QProgressBar* LV_SOC_BAR = this->findChild<QProgressBar*>("LV_SOC_BAR");
QProgressBar* POWER_SOC_BAR = this->findChild<QProgressBar*>("POWER_SOC_BAR");
QProgressBar* CONSUMED_POWER_BAR = this->findChild<QProgressBar*>("CONSUMED_POWER_BAR");





connect(store_ref, &store::vehicleSpeedChanged, [SPEED_DISPLAY](int m_vehicleVelocity) {
SPEED_DISPLAY->display(m_vehicleVelocity);});


//connect(store_ref, &store::rpmChanged,SPEED_DISPLAY, (void (QLCDNumber::*)(short, short))&QLCDNumber::show;
connect(store_ref, &store::vehicleSpeedChanged, INVERTER_TEMP_DISPLAY, QOverload<int>::of(&QLCDNumber::display));
INVERTER_TEMP_DISPLAY->show();


connect(store_ref, &store::vehicleSpeedChanged, MOTOR_TEMP_DISPLAY, QOverload<int>::of(&QLCDNumber::display));
MOTOR_TEMP_DISPLAY->show();

connect(store_ref, &store::vehicleSpeedChanged, ACUMULATOR_TEMP_DISPLAY, QOverload<int>::of(&QLCDNumber::display));
INVERTER_TEMP_DISPLAY->show();





connect(store_ref,&store::socChanged,[HV_SOC_BAR](int soc){
HV_SOC_BAR->setValue(soc);
});

connect(store_ref,&store::socChanged,[LV_SOC_BAR](int soc){
LV_SOC_BAR->setValue(soc);
});

connect(store_ref,&store::socChanged,[POWER_SOC_BAR](int soc){
POWER_SOC_BAR->setValue(soc);
});

connect(store_ref,&store::socChanged,[CONSUMED_POWER_BAR](int soc){
CONSUMED_POWER_BAR->setValue(soc);
});
}


Expand All @@ -66,3 +116,5 @@ PilotWindow::~PilotWindow(){
store_ref->~store();
delete ui;
}


5 changes: 3 additions & 2 deletions src/pilot.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


QT_BEGIN_NAMESPACE
namespace Ui { class PilotWindow; }
namespace Ui { class pilot; }
QT_END_NAMESPACE

class PilotWindow : public QMainWindow
Expand All @@ -19,10 +19,11 @@ class PilotWindow : public QMainWindow
PilotWindow(QWidget *parent = nullptr, QString serialDev=nullptr);
store* getStore();
~PilotWindow();
void switch_screen(int menu);

private:

Ui::PilotWindow *ui;
Ui::pilot *ui;
};


Expand Down
Loading

0 comments on commit 35724ae

Please sign in to comment.