Skip to content

Commit fa7e469

Browse files
author
John Lee
committed
update xu3 Ernergy Monitor compatibility
1 parent 7589b56 commit fa7e469

File tree

3 files changed

+34
-40
lines changed

3 files changed

+34
-40
lines changed

displaysysinfo.cpp

+32-22
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,17 @@
44
#include <QTimer>
55
#include <QDebug>
66
#include <QPalette>
7+
#include <QLabel>
78

89
DisplaySysInfo::DisplaySysInfo(QWidget *parent) :
910
QWidget(parent),
1011
ui(new Ui::DisplaySysInfo)
1112
{
1213
ui->setupUi(this);
1314

14-
QTimer *timer = new QTimer(this);
15-
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
16-
timer->start(1000);
17-
18-
getNode = new GetNode();
19-
20-
displayCpuFrequency();
21-
22-
if (getNode->OpenINA231())
23-
qDebug() << "OpenINA231 error";
24-
else
25-
getNode->GetINA231();
15+
QLabel *version = new QLabel(this);
16+
version->setText("S/W Version : 1.1");
17+
version->setGeometry(10, 350, 150, 20);
2618

2719
armPlotData.index = 0;
2820
memPlotData.index = 0;
@@ -34,12 +26,28 @@ DisplaySysInfo::DisplaySysInfo(QWidget *parent) :
3426
gpuVolt = gpuAmpere = gpuWatt = "";
3527
memVolt = memAmpere = memWatt = "";
3628

37-
ARMSensorCurve = new QwtPlotCurve();
38-
MEMSensorCurve = new QwtPlotCurve();
39-
KFCSensorCurve = new QwtPlotCurve();
40-
G3DSensorCurve = new QwtPlotCurve();
29+
getNode = new GetNode();
30+
31+
SENSOR_OPEN = 1;
32+
33+
if (getNode->OpenINA231()) {
34+
qDebug() << "OpenINA231 error";
35+
SENSOR_OPEN = 0;
36+
QLabel *lb = new QLabel(this);
37+
lb->setText("no Energy Sensors");
38+
lb->setGeometry(420, 230,130, 50);
39+
} else {
40+
ARMSensorCurve = new QwtPlotCurve();
41+
MEMSensorCurve = new QwtPlotCurve();
42+
KFCSensorCurve = new QwtPlotCurve();
43+
G3DSensorCurve = new QwtPlotCurve();
44+
displaySensorPlot();
45+
}
46+
47+
QTimer *timer = new QTimer(this);
48+
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
49+
timer->start(1000);
4150

42-
displaySensorPlot();
4351
}
4452

4553
DisplaySysInfo::~DisplaySysInfo()
@@ -221,11 +229,13 @@ void DisplaySysInfo::displayCpuFrequency()
221229
void DisplaySysInfo::update()
222230
{
223231
displayCpuFrequency();
224-
DisplaySensor();
225-
drawARMSensorCurve();
226-
drawMEMSensorCurve();
227-
drawKFCSensorCurve();
228-
drawG3DSensorCurve();
232+
if (SENSOR_OPEN) {
233+
DisplaySensor();
234+
drawARMSensorCurve();
235+
drawMEMSensorCurve();
236+
drawKFCSensorCurve();
237+
drawG3DSensorCurve();
238+
}
229239
// getNode->GetCPUUsage();
230240
// ui->CPU0UsageEdit->setText(QString::number(getNode->usage[0]));
231241
// ui->CPU1UsageEdit->setText(QString::number(getNode->usage[1]));

displaysysinfo.h

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class DisplaySysInfo : public QWidget
2929
private:
3030
Ui::DisplaySysInfo *ui;
3131

32+
unsigned char SENSOR_OPEN;
33+
3234
GetNode *getNode;
3335
QwtPlotCurve *ARMSensorCurve;
3436
QwtPlotCurve *MEMSensorCurve;

displaysysinfo.ui

-18
Original file line numberDiff line numberDiff line change
@@ -1002,24 +1002,6 @@
10021002
<string>MHz</string>
10031003
</property>
10041004
</widget>
1005-
<widget class="QLabel" name="label_18">
1006-
<property name="geometry">
1007-
<rect>
1008-
<x>11</x>
1009-
<y>350</y>
1010-
<width>111</width>
1011-
<height>17</height>
1012-
</rect>
1013-
</property>
1014-
<property name="font">
1015-
<font>
1016-
<pointsize>10</pointsize>
1017-
</font>
1018-
</property>
1019-
<property name="text">
1020-
<string>S/W Version : 1.0</string>
1021-
</property>
1022-
</widget>
10231005
<widget class="QLabel" name="label_38">
10241006
<property name="geometry">
10251007
<rect>

0 commit comments

Comments
 (0)