forked from haro78/MEMS-Scan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
223 lines (203 loc) · 6.24 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
#include <QLabel>
#include <QThread>
#include <QHash>
#include <QPair>
#include <QTimer>
#include <analogwidgets/manometer.h>
#include <analogwidgets/manometer100.h>
#include <analogwidgets/manometer900.h>
#include <qledindicator/qledindicator.h>
#include "optionsdialog.h"
#include "memsinterface.h"
#include "aboutbox.h"
#include "logger.h"
#include "commonunits.h"
#include "helpviewer.h"
#include <qapplication.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qobject.h>
#include <iostream>
#include <QTreeWidget>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void onDataReady();
void onConnect();
void onDisconnect();
void onReadError();
void onReadSuccess();
void onFailedToConnect(QString dev);
void onInterfaceThreadReady();
void onNotConnected();
void onEcuIdReceived(uint8_t* id);
void LambdaMaxOnce();
void LambdaMinOnce();
void IACMinOnce();
void clearRecordedAnomalies();
void onFuelPumpTestComplete();
void onO2HeaterTestComplete();
void onBoostValveTestComplete();
void onPurgeValveTestComplete();
void onACRelayTestComplete();
void onPTCRelayTestComplete();
void onFan1TestComplete();
void onFan2TestComplete();
void onFan3TestComplete();
void onMoveIACComplete();
void onCommandError();
void onFaultCodeClearComplete();
void onAdjustmentsResetComplete();
void onECUResetComplete();
void onConfirmResetECU();
void onConfirmResetAdjustments();
signals:
void requestToStartPolling();
void requestThreadShutdown();
void ResetAdjustmentsRequested();
void ResetECURequested();
void fuelPumpTest();
void fuelPumpOn();
void fuelPumpOff();
void ptcRelayTest();
void ptcRelayOn();
void ptcRelayOff();
void acRelayTest();
void acRelayOn();
void acRelayOff();
void injectorTest();
void coilTest();
void moveIAC(int desiredPos);
void fuel_trim_plus();
void fuel_trim_minus();
void idle_decay_plus();
void idle_decay_minus();
void idle_speed_plus();
void idle_speed_minus();
void ignition_advance_plus();
void ignition_advance_minus();
void Purge_Valve_Test();
void Purge_Valve_On();
void Purge_Valve_Off();
void O2Heater_Test();
void O2Heater_On();
void O2Heater_Off();
void Boost_Valve_Test();
void Boost_Valve_On();
void Boost_Valve_Off();
void Fan1_Test();
void Fan2_Test();
void Fan3_Test();
void Fan1_On();
void Fan2_On();
void Fan3_On();
void Fan1_Off();
void Fan2_Off();
void Fan3_Off();
void OpenIAC();
void CloseIAC();
void AllActuators_Off();
void interactive_mode();
protected:
void closeEvent(QCloseEvent *event);
private:
Ui::MainWindow *m_ui;
QThread *m_memsThread;
MEMSInterface *m_mems;
OptionsDialog *m_options;
AboutBox *m_aboutBox;
QMessageBox *m_pleaseWaitBox;
HelpViewer *m_helpViewerDialog;
Logger *m_logger;
const float mapGaugeMaxPsi = 16.0; // vorher static
const float mapGaugeMaxKPa = 160.0; // vorher static
bool m_actuatorTestsEnabled;
bool m_actuatorsOffEnabled;
bool m_adjustmentsEnabled;
QHash<TemperatureUnits,QString> *m_tempUnitSuffix;
QHash<TemperatureUnits,QPair<int,int> > *m_tempRange;
QHash<TemperatureUnits,QPair<int,int> > *m_tempLimits;
QHash<TemperatureUnits,QPair<int,int> > *m_airtempRange;
QHash<TemperatureUnits,QPair<int,int> > *m_airtempLimits;
void buildSpeedAndTempUnitTables();
void setupWidgets();
int convertTemperature(int tempF);
int convertLambda(int scaleMems);
void addTreeRoot(QString name, QString description);
void addTreeChild(QTreeWidgetItem *parent,
QString name, QString description);
private slots:
void onExitSelected();
void onEditOptionsClicked();
void onHelpContentsClicked();
void onHelpAboutClicked();
void onConnectClicked();
void onDisconnectClicked();
void onStartLogging();
void onStopLogging();
void onMoveIACClicked();
void onTestFuelPumpRelayClicked();
void onTestFuelPumpOnClicked();
void onTestFuelPumpOffClicked();
void onTestACRelayClicked();
void onOnACRelayClicked();
void onOffACRelayClicked();
void onTestPTCRelayClicked();
void onOnPTCRelayClicked();
void onOffPTCRelayClicked();
void setActuatorTestsEnabled(bool enabled);
void setActuatorsOffEnabled(bool enables);
void setAdjustmentsEnabled(bool enabled);
void on_m_fuel_trim_plusButton_clicked();
void on_m_fuel_trim_minusButton_clicked();
void on_m_idle_decay_plusButton_clicked();
void on_m_idle_decay_minusButton_clicked();
void on_m_idle_speed_plusButton_clicked();
void on_m_idle_speed_minusButton_clicked();
void on_exitButton_clicked();
void on_m_ignition_advance_plusButton_clicked();
void on_m_ignition_advance_minusButton_clicked();
void on_m_idle_air_plusButton_clicked();
void on_m_idle_air_minusButton_clicked();
void on_interactive_push_button_clicked();
void on_m_Purge_Valve_TestButton_clicked();
void on_m_Purge_Valve_OnButton_clicked();
void on_m_Purge_Valve_OffButton_clicked();
void on_m_O2Heater_TestButton_clicked();
void on_m_O2Heater_OnButton_clicked();
void on_m_O2Heater_OffButton_clicked();
void on_m_Boost_Valve_TestButton_clicked();
void on_m_Boost_Valve_OnButton_clicked();
void on_m_Boost_Valve_OffButton_clicked();
void on_m_Fan1_TestButton_clicked();
void on_m_Fan2_TestButton_clicked();
void on_m_Fan3_TestButton_clicked();
void on_m_Fan1_OnButton_clicked();
void on_m_Fan2_OnButton_clicked();
void on_m_Fan3_OnButton_clicked();
void on_m_Fan1_OffButton_clicked();
void on_m_Fan2_OffButton_clicked();
void on_m_Fan3_OffButton_clicked();
void on_m_IACMinusButton_clicked();
void on_m_IACPlusButton_clicked();
void on_m_AllActuatorsOffButton_clicked();
};
class MainWidget : public QWidget
{
Q_OBJECT
public:
MainWidget(QWidget *parent = 0, const char *name = 0);
};
#endif // MAINWINDOW_H