Skip to content

Commit

Permalink
banana
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno3634-gif committed Aug 24, 2024
1 parent e7b1121 commit 19aeb68
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ int main(int argc, char *argv[]){
check_menu(value);
});*/

PilotWindow pl;
pl.show();

//PilotWindow pl;
//pl.show();
MainWindow m;
m.show();


//VoidsterdebugWindow debugWindow;
Expand Down
2 changes: 1 addition & 1 deletion src/pilot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PilotWindow::PilotWindow(QWidget *parent, QString serialDev)
HV_SOC_BAR->setValue(soc);
});

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

Expand Down
2 changes: 2 additions & 0 deletions src/references/bson_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define BSON_VEHICLESPEED "vel"
#define BSON_MOTORTEMPERATURE "eng_t"
#define BSON_BATTERYVOLTAGE "bat_v"
#define BSON_IGNITION "ignition"

#ifdef __LART_T14__
#define BSON_GEARSHIFT "gear"
Expand All @@ -34,6 +35,7 @@
#define BSON_HV "hv"
#define BSON_MENU "menu"
#define BSON_POWER_LIMIT "power_available"
#define BSON_LV_SOC "lv_soc"
#endif


Expand Down
39 changes: 34 additions & 5 deletions src/store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,19 @@ void store::parseBson(std::vector<std::uint8_t> v){
this->setMenu(t);
if(m_menu != t)
{
//store::closeSerial();
//VoidsterdebugWindow debugWindow;
//PilotWindow pl;
store::closeSerial();
VoidsterdebugWindow debugWindow;
PilotWindow pl;
// VoidsterdebugWindow debugWindow = new VoidsterdebugWindow();
//PilotWindow pl = new PilotWindow();
switch(t)
{
case 0:
//pl.show();
pl.show();

break;
case 1:
// debugWindow.show();
debugWindow.show();
//QMessageBox::information(nullptr, "Menu 0", "Menu 0 has been selected.");
break;
default:
Expand All @@ -368,6 +368,11 @@ void store::parseBson(std::vector<std::uint8_t> v){
t.encoded=j[BSON_SOC];
this->setSoc(t.decoded);
}
if(j.contains(BSON_LV_SOC)){
EncodingUnion t;
t.encoded=j[BSON_LV_SOC];
this->setLV_Soc(t.decoded);
}
if(j.contains(BSON_MOTORTEMPERATURE)){
// EncodingUnion t;
// t.encoded=j[BSON_MOTORTEMPERATURE];
Expand Down Expand Up @@ -705,6 +710,15 @@ float store::getSoc() const{
}


/**
* @brief getter for the state of charge variable
* @return The lv state of charge variable
**/
float store::getLV_Soc() const{
return this->m_lv_stateOfCharge;
}


/**
* @brief getter for the state of charge variable
* @return The state of charge variable
Expand Down Expand Up @@ -781,6 +795,21 @@ void store::setSoc(float soc){





/**
* @brief setter for the state of charge variable
* @param LV_soc The new value for the state of charge variable
**/
void store::setLV_Soc(float soc){
float oldSoc = this->m_lv_stateOfCharge;
this->m_stateOfCharge=soc;
emit socChanged(this->m_lv_stateOfCharge, oldSoc);
}




/**
* @brief setter for the power limit
* @param power limit The new value for the state of charge variable
Expand Down
8 changes: 6 additions & 2 deletions src/store.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class store: public QObject{

#endif
#ifdef __LART_T24__
float getSoc() const;
float getSoc() const;
float getLV_Soc() const;
float getPowerLimit() const;
float getBatteryTemperature() const;
int getInverterTemperature() const;
Expand All @@ -156,6 +157,7 @@ class store: public QObject{
//int getTyreTemperature() const;

void setSoc(float soc);
void setLV_Soc(float soc);
void setPowerLimit(float powerl);
void setBatteryTemperature(float batteryTemperature);
void setInverterTemperature(int inverterTemperature);
Expand Down Expand Up @@ -195,7 +197,8 @@ class store: public QObject{
void tcLaunchChanged(int newTcLaunch, int oldTcLaunch);
#endif
#ifdef __LART_T24__
void socChanged(float newSoc, float oldSoc);
void socChanged(float newSoc, float oldSoc);
void lvsocChanged(float newSoc, float oldSoc);
void power_limitChanged(float newlimit, float oldlimit);
void batteryTemperatureChanged(float newBatteryTemperature, float oldBatteryTemperature);
void inverterTemperatureChanged(int newInverterTemperature, int oldInverterTemperature);
Expand Down Expand Up @@ -228,6 +231,7 @@ class store: public QObject{
#endif
#ifdef __LART_T24__
float m_stateOfCharge=0;
float m_lv_stateOfCharge = 0;
float m_power_limit = 0;
float m_batteryTemperature=0;
int m_inverterTemperature=0;
Expand Down

0 comments on commit 19aeb68

Please sign in to comment.