Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Logs: Added log reading class
Browse files Browse the repository at this point in the history
  • Loading branch information
malcom2073 committed Jul 11, 2022
1 parent a0c8db4 commit 522fe1b
Show file tree
Hide file tree
Showing 12 changed files with 407 additions and 23 deletions.
28 changes: 14 additions & 14 deletions default_dashboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Rectangle {
text: "RPM"
property string propertyMapProperty: "RPM"
//Behavior on m_value { PropertyAnimation { properties: "m_value"; duration: (propertyMap["RPM_DURATION"] ? propertyMap["RPM_DURATION"] : 50) } }
m_value: (propertyMap["RPMValue"] ? propertyMap["RPMValue"] : 0)
m_value: (propertyMap["RPM"] ? propertyMap["RPM"] : 0)
}
GaugeImage {
x:300
Expand All @@ -37,24 +37,24 @@ Rectangle {
startAngle:45
endAngle:315
text: "Ign Timing"
property string propertyMapProperty:"Advance"
property string propertyMapProperty:"timing"
//Behavior on m_value { PropertyAnimation { properties: "m_value"; duration: (propertyMap["Advance_DURATION"] ? propertyMap["Advance_DURATION"] : 50) } }
m_value: (propertyMap["Advance"] ? propertyMap["Advance"] : 0)
m_value: (propertyMap["timing"] ? propertyMap["timing"] : 0)
}
GaugeImage {
x:0
y:300
width:300
height:300
minimum:0
maximum:50
maximum:25
numLabels:5
startAngle:45
endAngle:315
text: "Pulse Width"
property string propertyMapProperty:"EffectivePW"
text: "AFR"
property string propertyMapProperty:"Air/Fuel Ratio"
//Behavior on m_value { PropertyAnimation { properties: "m_value"; duration: (propertyMap["EffectivePW_DURATION"] ? propertyMap["EffectivePW_DURATION"] : 50) } }
m_value: (propertyMap["EffectivePW"] ? propertyMap["EffectivePW"] : 0)
m_value: (propertyMap["Air/Fuel Ratio"] ? propertyMap["Air/Fuel Ratio"] : 0)
}
GaugeImage {
x:300
Expand All @@ -67,24 +67,24 @@ Rectangle {
startAngle:45
endAngle:315
text: "Coolant"
property string propertyMapProperty:"CHT"
property string propertyMapProperty:"CLT"
//Behavior on m_value { PropertyAnimation { properties: "m_value"; duration: (propertyMap["CHT_DURATION"] ? propertyMap["CHT_DURATION"] : 50) } }
m_value: (propertyMap["CHT"] ? propertyMap["CHT"] : 0)
m_value: (propertyMap["CLT"] ? propertyMap["CLT"] : 0)
}
GaugeImage {
x:600
y:0
width:300
height:300
minimum:0
maximum:2
maximum:100
numLabels:2
startAngle:45
endAngle:315
text: "O2"
property string propertyMapProperty:"EGO"
text: "TPS"
property string propertyMapProperty:"TPS"
//Behavior on m_value { PropertyAnimation { properties: "m_value"; duration: (propertyMap["EGO_DURATION"] ? propertyMap["EGO_DURATION"] : 50) } }
m_value: (propertyMap["EGO"] ? propertyMap["EGO"] : 0)
m_value: (propertyMap["TPS"] ? propertyMap["TPS"] : 0)
}
GaugeImage {
x:600
Expand All @@ -99,7 +99,7 @@ Rectangle {
text: "MAP"
property string propertyMapProperty:"MAP"
//Behavior on m_value { PropertyAnimation { properties: "m_value"; duration: (propertyMap["MAP_DURATION"] ? propertyMap["MAP_DURATION"] : 50) } }
m_value: (propertyMap["MAPValue"] ? propertyMap["MAPValue"] : 0)
m_value: (propertyMap["MAP"] ? propertyMap["MAP"] : 0)
}
Rectangle {
x:900
Expand Down
5 changes: 5 additions & 0 deletions emstudio.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ SOURCES += \
src/filedownloader.cpp \
src/gaugeitem.cpp \
src/interrogateprogressview.cpp \
src/logcontrolbar.cpp \
src/logfilemanager.cpp \
src/overviewprogressitemdelegate.cpp \
src/parambuttonbar.cpp \
src/scalarconfigdata.cpp \
Expand Down Expand Up @@ -55,6 +57,8 @@ HEADERS += \
src/filedownloader.h \
src/gaugeitem.h \
src/interrogateprogressview.h \
src/logcontrolbar.h \
src/logfilemanager.h \
src/overviewprogressitemdelegate.h \
src/parambuttonbar.h \
src/scalarconfigdata.h \
Expand Down Expand Up @@ -102,6 +106,7 @@ HEADERS += \

FORMS += \
src/consoletextview.ui \
src/logcontrolbar.ui \
src/tableview2d.ui \
src/ui/connectiondialog.ui \
src/ui/interrogateprogressview.ui \
Expand Down
7 changes: 6 additions & 1 deletion src/configdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ class ConfigData : public QObject
}
static inline QVariant BytesToFloat(QByteArray value)
{
float val = *reinterpret_cast<float*>(value.data());
QByteArray reverse;
for (int i=0;i<value.size();i++)
{
reverse.prepend(value[i]);
}
float val = *reinterpret_cast<float*>(reverse.data());
return QVariant(val);
}
static inline QByteArray ValueToBytes(QVariant value, int size, bool issigned,bool isbig)
Expand Down
46 changes: 46 additions & 0 deletions src/logcontrolbar.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "logcontrolbar.h"
#include "ui_logcontrolbar.h"

LogControlBar::LogControlBar(QWidget *parent) :
QWidget(parent),
ui(new Ui::LogControlBar)
{
ui->setupUi(this);
connect(ui->logTimeSlider,&QSlider::sliderPressed,this,&LogControlBar::sliderPressed);
connect(ui->logTimeSlider,&QSlider::sliderReleased,this,&LogControlBar::sliderReleased);
connect(ui->logTimeSlider,&QSlider::sliderMoved,this,&LogControlBar::sliderMoved);
m_sliderPressed = false;
}
void LogControlBar::sliderPressed()
{
m_sliderPressed = true;
}
void LogControlBar::sliderReleased()
{
emit logPosChanged(m_currentPos);
m_sliderPressed = false;
}
void LogControlBar::sliderMoved(int pos)
{
if (m_sliderPressed)
{
m_currentPos = pos;
}
}
LogControlBar::~LogControlBar()
{
delete ui;
}
void LogControlBar::setTime(int current,int total)
{
if (m_sliderPressed)
{
return;
}
m_currentPos = current;
if (ui->logTimeSlider->maximum() != total)
{
ui->logTimeSlider->setMaximum(total);
}
ui->logTimeSlider->setValue(current);
}
30 changes: 30 additions & 0 deletions src/logcontrolbar.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef LOGCONTROLBAR_H
#define LOGCONTROLBAR_H

#include <QWidget>

namespace Ui {
class LogControlBar;
}

class LogControlBar : public QWidget
{
Q_OBJECT

public:
explicit LogControlBar(QWidget *parent = nullptr);
~LogControlBar();
void setTime(int current,int total);
signals:
void logPosChanged(int pos);
private slots:
void sliderPressed();
void sliderReleased();
void sliderMoved(int pos);
private:
int m_currentPos;
bool m_sliderPressed;
Ui::LogControlBar *ui;
};

#endif // LOGCONTROLBAR_H
42 changes: 42 additions & 0 deletions src/logcontrolbar.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LogControlBar</class>
<widget class="QWidget" name="LogControlBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>847</width>
<height>115</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="stopButton">
<property name="text">
<string>Stop</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playButton">
<property name="text">
<string>Play</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="logTimeSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit 522fe1b

Please sign in to comment.