Skip to content

Commit

Permalink
AfterFixingKernell
Browse files Browse the repository at this point in the history
  • Loading branch information
Imeguras committed Sep 1, 2024
1 parent 5418ebb commit 806284c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 41 deletions.
42 changes: 17 additions & 25 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@ MainWindow::MainWindow(QWidget *parent, QString serialDev)
store_ref = new store(serialDev);

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

FLabel* EngineTemperature_Label= this->findChild<FLabel*>("EngineTemperature_Label");
FLabel* BatteryVoltage_Label = this->findChild<FLabel*>("BatteryVoltage_Label");
FLabel* VehicleSpeed_Label = this->findChild<FLabel*>("VehicleSpeed_Label");
connect(store_ref, &store::engineTemperatureChanged, EngineTemperature_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::batteryVoltageChanged, BatteryVoltage_Label, (void (FLabel::*)(float, float))&FLabel::setVisual);
connect(store_ref, &store::vehicleSpeedChanged, VehicleSpeed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
FLabel* VehicleSpeed_Label = this->findChild<FLabel*>("Speed_Label");
connect(store_ref, &store::vehicleSpeedChanged, VehicleSpeed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
/**
* @brief bellow is the spaggeti code thats preprocessed to permit portable use between vehicles
* The magic occurs in qmake through the DEFINES variable.
Expand All @@ -44,30 +37,29 @@ MainWindow::MainWindow(QWidget *parent, QString serialDev)

#ifdef __LART_T24__
QProgressBar* Soc_Label = this->findChild<QProgressBar*>("SOCLimitBar");
QProgressBar* Power_Limit_Label = this->findChild<QProgressBar*>("PowerLimitBar");
FLabel* Speed_Label = this->findChild<FLabel*>("speed_Label");
FLabel* InverterTemperature_Label = this->findChild<FLabel*>("InverterTemperature_Label");
FLabel* Consumed_Power_Label = this->findChild<FLabel*>("Consumed_Label");
QProgressBar* ConsumedPowerBar = this->findChild<QProgressBar*>("ConsumedPowerBar");

FLabel* PowerLimit_Label = this->findChild<FLabel*>("PowerLimit_Label");
//TODO change representation of laptime
FLabel* LapTime_Label = this->findChild<FLabel*>("LapTime_Label");
FLabel* DiffTime_Label = this->findChild<FLabel*>("DiffTime_Label");
FLabel* LapCount_Label = this->findChild<FLabel*>("LapCount_Label");
FLabel* AbsoluteTime_Label = this->findChild<FLabel*>("AbsoluteTime_Label");
FLabel* DiffBestLap_label = this->findChild<FLabel*>("DiffBestLap_label");
FLabel* DiffLastLap_label = this->findChild<FLabel*>("DiffLastLap_label");
FLabel* LapCount_label = this->findChild<FLabel*>("LapCount_label");
//FLabel* TyreTemperature_Label = this->findChild<FLabel*>("TyreTemperature_Label");
connect(store_ref,&store::socChanged,[Soc_Label](int soc){
Soc_Label->setValue(soc);
});
connect(store_ref,&store::power_limitChanged,[Power_Limit_Label](int power){
Power_Limit_Label->setValue(power);
connect(store_ref,&store::powerChanged,[ConsumedPowerBar](short power){
PowerLimit_Label->setValue(power);
});

connect(store_ref, &store::vehicleSpeedChanged, Speed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::vehicleSpeedChanged, Speed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::inverterTemperatureChanged, InverterTemperature_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::powerChanged, Consumed_Power_Label, (void (FLabel::*)(short, short))&FLabel::setVisual);
connect(store_ref, &store::lapTimeChanged, LapTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::diffLapTimeChanged, DiffTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::vehicleSpeedChanged, VehicleSpeed_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);

connect(store_ref, &store::power_limitChanged, PowerLimit_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);
connect(store_ref, &store::lapTimeChanged, LapTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::diffLapTimeChanged, DiffTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::absoluteTimeChanged, AbsoluteTime_Label, (void (FLabel::*)(QTime, QTime))&FLabel::setVisual);
connect(store_ref, &store::lapCountChanged, LapCount_Label, (void (FLabel::*)(short, short))&FLabel::setVisual);
//connect(store_ref, &store::tyreTemperatureChanged, TyreTemperature_Label, (void (FLabel::*)(int, int))&FLabel::setVisual);


#endif
Expand Down
27 changes: 15 additions & 12 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@
<pointsize>12</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>BlankCursor</cursorShape>
</property>
<property name="windowTitle">
<string>LukHudX</string>
</property>
Expand Down Expand Up @@ -287,7 +290,7 @@
<number>30</number>
</property>
<item>
<widget class="QProgressBar" name="PowerLimitBar">
<widget class="QProgressBar" name="ConsumedPowerBar">
<property name="minimumSize">
<size>
<width>100</width>
Expand Down Expand Up @@ -445,15 +448,15 @@
</font>
</property>
<property name="text">
<string>+00:00.000</string>
<string>__</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignHCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="IgnitionTime_label">
<widget class="QLabel" name="AbsoluteTime_Label">
<property name="font">
<font>
<family>Fira Mono</family>
Expand All @@ -462,7 +465,7 @@
</font>
</property>
<property name="text">
<string>00:00:00</string>
<string>__</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignHCenter</set>
Expand All @@ -479,7 +482,7 @@
</font>
</property>
<property name="text">
<string>-00:00.000</string>
<string>__</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignHCenter</set>
Expand All @@ -496,7 +499,7 @@
</font>
</property>
<property name="text">
<string>0</string>
<string>__</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignBottom|Qt::AlignmentFlag::AlignHCenter</set>
Expand All @@ -512,7 +515,7 @@
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="1">
<widget class="QLabel" name="Velocity_Suffix">
<widget class="QLabel" name="Speed_Suffix">
<property name="maximumSize">
<size>
<width>200</width>
Expand All @@ -532,7 +535,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="FLabel" name="Consumed_Label">
<widget class="FLabel" name="PowerLimit_Label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
Expand All @@ -559,12 +562,12 @@
</font>
</property>
<property name="text">
<string>80</string>
<string>__</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="Consumed_Suffix">
<widget class="QLabel" name="PowerLimit_Suffix">
<property name="minimumSize">
<size>
<width>0</width>
Expand All @@ -590,7 +593,7 @@
</widget>
</item>
<item row="0" column="0">
<widget class="FLabel" name="speed_Label">
<widget class="FLabel" name="Speed_Label">
<property name="minimumSize">
<size>
<width>194</width>
Expand All @@ -611,7 +614,7 @@
</font>
</property>
<property name="text">
<string>100</string>
<string>__</string>
</property>
</widget>
</item>
Expand Down
9 changes: 5 additions & 4 deletions src/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,11 @@ class store: public QObject{
void batteryTemperatureChanged(float newBatteryTemperature, float oldBatteryTemperature);
void inverterTemperatureChanged(int newInverterTemperature, int oldInverterTemperature);
void motorTemperatureChanged(int newmotorTemperature, int oldmotorTemperature);
void powerChanged(short newPower, short oldPower);
void lapTimeChanged(QTime newLapTime, QTime oldLapTime);
void diffLapTimeChanged(QTime newDiffLapTime, QTime oldDiffLapTime);
void lapCountChanged(short newLapCount, short oldLapCount);
void powerChanged(short newPower, short oldPower);
void diffLastLapTimeChanged(QTime newDiffLastLapTime, QTime oldDiffLastLapTime);
void diffBestLapTimeChanged(QTime newdiffBestLapTime, QTime olddiffBestLapTime);
void absoluteTimeChanged(QTime newTimeChanged, QTime old);
void lapCountChanged(short newLapCount, short oldLapCount);
void hvChanged(short newHV, short oldHV );
void bat_voltageChanged(short newhv, short oldhv);
void max_cell_voltageChanged(int new_cell_v, int old_cell_v);
Expand Down

0 comments on commit 806284c

Please sign in to comment.