forked from donaloconnor/automon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coolanttempsensor.cpp
51 lines (41 loc) · 2.21 KB
/
coolanttempsensor.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
/*
==================================================================================================
| commandedegr.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 "Coolant Temperature" Sensor object.
In here we set the Formula, Command, Units, Expected Bytes, Min and Max Values
*/
#include "automon.h"
using namespace AutomonKernel;
CoolantTempSensor::CoolantTempSensor(QString command, QString englishMeaning)
{
m_command = command;
m_englishMeaning = englishMeaning;
}
CoolantTempSensor::CoolantTempSensor()
{
m_command = "0105";
m_englishMeaning = "Engine coolant temperature";
setUnits(DEGREES);
setExpectedBytes(1);
setMin(-40);
setMax(215);
}
double CoolantTempSensor::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 = (bytes[2]-40);
return value;
}