Skip to content
Snippets Groups Projects
Commit d141d423 authored by Davide Rosato's avatar Davide Rosato Committed by Davide Mor
Browse files

[RefuelingVisualizer] Made it faster

parent bba20876
No related branches found
No related tags found
No related merge requests found
Pipeline #6989 failed
......@@ -167,7 +167,9 @@
"qtvirtualkeyboard": "cpp",
"qabstractbutton": "cpp",
"qmetatype": "cpp",
"xlocmon": "cpp"
"xlocmon": "cpp",
"xstring": "cpp",
"xutility": "cpp"
},
"editor.defaultFormatter": "ms-vscode.cpptools",
"[xml]": {
......
......@@ -23,10 +23,9 @@
#include <Modules/DefaultModule/DefaultModule.h>
#include <QLabel>
#include <QMap>
#include <QWidget>
#include "RefuelingVisualizerCommandList.h"
class RefuelingVisualizer : public DefaultModule
{
Q_OBJECT
......@@ -42,48 +41,118 @@ public:
private:
void setupUi();
// void addCustomActionsToMenu() override;
// void onConfigureClicked();
// void setFilter(const Filter& filter);
QGridLayout* outerLayout;
QList<uint64_t> valveStatus;
QString valveLabelStyleOFF;
QString valveLabelStyleON;
void onMsgReceivedGSE(const Message& msg);
void onMsgReceivedMOT(const Message& msg);
void backgroundTabs(Message msg);
void changeValves(int i, uint64_t status);
void addQLabels();
void changeData(int i, const Message& msg);
void backgroundPreSet();
/* void onMsgReceivedMOT(const Message& msg); */
QGridLayout* outerLayout;
QLabel* labelTarsTab;
QList<uint64_t> labelStatus;
// TANK VISUALIZER LABELS
QLabel* tankHeaderLabel;
QLabel* topTankPressureLabel;
QLabel* bottomTankPressureLabel;
QLabel* loadcellTankLabel;
QLabel* floatingLevelLabel;
QLabel* tankTemperatureLabel;
QLabel* topTankPressureDataLabel;
QLabel* bottomTankPressureDataLabel;
QLabel* loadcellTankDataLabel;
QLabel* floatingLevelDataLabel;
QLabel* tankTemperatureDataLabel;
// VESSEL VISUALIZER LABELS
QLabel* vesselHeaderLabel;
QLabel* loadcellVesselLabel;
QLabel* vesselPressureLabel;
QLabel* loadcellVesselDataLabel;
QLabel* vesselPressureDataLabel;
// CART VISUALIZER LABELS
QLabel* cartHeaderLabel;
QLabel* cartTimestampLabel;
QLabel* cartFillingPressureLabel;
QLabel* cartBatteryLabel;
QLabel* cartCurrentLabel;
QLabel* cartTimestampDataLabel;
QLabel* cartFillingPressureDataLabel;
QLabel* cartBatteryDataLabel;
QLabel* cartCurrentDataLabel;
Filter filter;
RefuelingVisualizerCommandList::Valve currentState;
struct LabelInfo{
int index;
int y0;
int x0;
int dy;
int dx;
QString name;
QString type;
QString style;
};
struct msgType{
QString message;
QString topic;
};
struct data{
QLabel* Label;
QLineEdit* Text;
LabelInfo info;
msgType msg;
float value;
uint64_t status;
};
QLabel* newLabel;
QLineEdit* newLineEdit;
QList<data> QLabelsList{
{newLabel, newLineEdit, {1, 5499, 0, 70, 2750, "FILLING", "valve", "center"}, {"filling_valve_state", "GSE"}, 0, 0},
{newLabel, newLineEdit, {2, 5499, 2750, 70, 1100, "RELEASE", "valve", "center"}, {"release_valve_state", "GSE"}, 0, 0},
{newLabel, newLineEdit, {3, 5499, 3850, 70, 1150, "VENTING", "valve", "center"}, {"venting_valve_state", "GSE"}, 0, 0},
{newLabel, newLineEdit, {4, 5570, 0, 70, 5000, "TARS STATE", "valve", "center"}, {"tars_state", "GSE"}, 0, 0},
{newLabel, newLineEdit, {5, 5640, 0, 70, 5000, "MAIN", "valve", "center"}, {"main_valve_state", "MOT"}, 0, 0},
{newLabel, newLineEdit, {6, 500, 3200, 50, 1300, "VESSEL", "header", "center"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {7, 1180, 2200, 50, 1300, "TANK", "header", "center"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {8, 2590, 2940, 50, 1300, "CART", "header", "center"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {9, 550, 3200, 40, 1300, "Loadcell:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {10, 590, 3200, 40, 1300, "Pressure:", "lst_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {11, 1230, 2200, 40, 1300, "Loadcell:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {12, 1270, 2200, 40, 1300, "Temperature:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {13, 1310, 2200, 40, 1300, "TOP Pressure:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {14, 1350, 2200, 40, 1300, "BOTTOM Pressure:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {15, 1390, 2200, 40, 1300, "Floating level:", "lst_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {16, 2640, 2940, 40, 1300, "Timestamp:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {17, 2680, 2940, 40, 1300, "Filling Pressure:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {18, 2720, 2940, 40, 1300, "Battery:", "std_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {19, 2760, 2940, 40, 1300, "Current:", "lst_head", "left"}, {"", ""}, 0, 0},
{newLabel, newLineEdit, {20, 553, 4000, 34, 480, " KG", "std_data", "right"}, {"loadcell_vessel", "GSE"}, 0, 0},
{newLabel, newLineEdit, {21, 593, 4000, 34, 480, " bar", "lst_data", "right"}, {"vessel_pressure", "GSE"}, 0, 0},
{newLabel, newLineEdit, {22, 1233, 3000, 34, 480, " KG", "std_data", "right"}, {"loadcell_tank", "GSE"}, 0, 0},
{newLabel, newLineEdit, {23, 1273, 3000, 34, 480, " °C", "std_data", "right"}, {"tank_temperature", "MOT"}, 0, 0},
{newLabel, newLineEdit, {24, 1313, 3000, 34, 480, " bar", "std_data", "right"}, {"top_tank_pressure", "MOT"}, 0, 0},
{newLabel, newLineEdit, {25, 1353, 3000, 34, 480, " bar", "std_data", "right"}, {"bottom_tank_pressure", "MOT"}, 0, 0},
{newLabel, newLineEdit, {26, 1393, 3000, 34, 480, "NOT REACHED", "lst_data", "right"}, {"", "MOT"}, 0, 0},
{newLabel, newLineEdit, {27, 2640, 3740, 34, 480, " s", "std_data", "right"}, {"timestamp", "GSE"}, 0, 0},
{newLabel, newLineEdit, {28, 2680, 3740, 34, 480, " bar", "std_data", "right"}, {"filling_pressure", "GSE"}, 0, 0},
{newLabel, newLineEdit, {29, 2720, 3740, 34, 480, " V", "std_data", "right"}, {"battery_voltage", "GSE"}, 0, 0},
{newLabel, newLineEdit, {30, 2760, 3740, 34, 480, " A", "lst_data", "right"}, {"current_consumption", "GSE"}, 0, 0},
};
QLabel* background;
QList<QPalette> backgroundList;
QList<QPixmap> pixmapList;
QList<QString> backgroundNames{
"000", "001", "010", "011", "100", "101", "110", "111",
};
QString HeaderStyle;
QString std_headStyle;
QString lst_headStyle;
QString dataStyle;
/* const QMap<QString, QMap<QString, QMap<QString, QList<QString>>>> commandMap{
{"GSE", {{"valves", {{"FILLING_VALVE", {"FILLING", "filling_valve_state"}},
{"RELEASE_VALVE", {"RELEASE", "release_valve_state"}},
{"VENTING_VALVE", {"VENTING", "venting_valve_state"}},
{"TARS_STATE", {"TARS STATE", "tars_state"}}}},
{"tank_data", {{"LOADCELL", {"Loadcell", "loadcell_tank"}}}},
{"vessel_data", {{"LOADCELL", {"Loadcell", "loadcell_vessel"}},
{"PRESSURE", {"Pressure", "vessel_pressure"}}}},
{"cart_data", {{"TIME", {"Timestamp", "timestamp"}},
{"FILLING_PRESSURE", {"Filling Pressure", "filling_pressure"}},
{"BATTERY", {"Battery", "battery_voltage"}},
{"CURRENT", {"Current", "current_consumption"}}}}}},
{"MOT", {{"valves", {{"MAIN_VALVE", {"MAIN", "main_valve_state"}}}},
{"tank_data", {{"TEMPERATURE", {"Temperature", "tank_temperature"}},
{"TOP_PRES", {"TOP Pressure", "top_tank_pressure"}},
{"BOT_PRES", {"BOTTOM Pres", "bottom_tank_pressure"}}}}}},
}; */
/* const QMap<QString, data> labelMap{
{"FILLING", {5499, 0, 70, 1666, "valves", "center", "filling_valve_state", "GSE"}},
{"RELEASE", {5499, 1666, 70, 1666, "valves", "center", "release_valve_state", "GSE"}},
{"VENTING", {5499, 3332, 70, 1666, "valves", "center", "venting_valve_state", "GSE"}},
{"TARS STATE", {5570, 0, 70, 5000, "valves", "center", "tars_state", "GSE"}},
{"MAIN", {5640, 0, 70, 5000, "valves", "center", "main_valve_state", "MOT"}},
}; */
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment