forked from donaloconnor/automon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
engineruntime.cpp
52 lines (41 loc) · 2.2 KB
/
engineruntime.cpp
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
/*
==================================================================================================
| engineruntime.cpp |
| Part of the Automon application. |
| |
| Final Year Project - "An Embedded Automotive Monitoring Device" |
| |
| By Donal O' Connor for completion of B.Sc (Hons) Software Development and Computer Networking |
| Email: [email protected] |
| Website/Blog: http://automon.killarneyonline.eu |
| |
| Cork Institute of Technology, Cork, Ireland - http://www.cit.ie/ |
| |
| Copyright © 2009 Donal O'Connor <[email protected]> |
==================================================================================================
Implementation file of the "Engine Run time" Sensor object.
In here we set the Formula, Command, Units, Expected Bytes, Min and Max Values
*/
#include "automon.h"
using namespace AutomonKernel;
EngineRunTime::EngineRunTime(QString command, QString englishMeaning)
{
m_command = command;
m_englishMeaning = englishMeaning;
}
EngineRunTime::EngineRunTime()
{
m_command = "011F";
m_englishMeaning = "Engine Runtime";
setUnits(SECONDS);
setExpectedBytes(2);
setMin(0);
setMax(65535);
}
double EngineRunTime::convertResult()
{
/* This is the conversion formula. It basically returns the value from the bytes retrieved from the ECU */
QList<int> bytes = Automon::getBytes(*this);
double value = (((int)bytes[2]*256) + (int)bytes[3]);
return value;
}