rusEFI
The most advanced open source ECU
tps.h
Go to the documentation of this file.
1 /**
2  * @file tps.h
3  * @brief
4  *
5  *
6  * @date Nov 15, 2013
7  * @author Andrey Belomutskiy, (c) 2012-2020
8  */
9 
10 #pragma once
11 
12 #include "global.h"
13 #include "engine_configuration.h"
14 
15 // Scaled to 1000 counts = 5.0 volts
16 #define TPS_TS_CONVERSION 200
17 
18 // we have this '100' magic constant too often for two many other reasons todo: refactor further?
19 #define POSITION_FULLY_OPEN 100
20 
21 constexpr inline int convertVoltageTo10bitADC(float voltage) {
22  return (int) (voltage * TPS_TS_CONVERSION);
23 }
24 
25 struct SentTps : public StoredValueSensor {
27  }
28 
29  bool isRedundant() const override {
30  return true;
31  }
32 };
33 
34 void grabTPSIsClosed();
35 void grabTPSIsWideOpen();
36 void grabPedalIsUp();
37 void grabPedalIsWideOpen();
38 
39 void sentTpsDecode();
40 float decodeTpsSentValue(float sentValue);
41 bool isDigitalTps1();
42 
43 bool isTps1Error();
44 bool isTps2Error();
45 bool isPedalError();
Base class for sensors that compute a value on one thread, and want to make it available to consumers...
Main engine configuration data structure.
SensorType
Definition: sensor_type.h:18
Definition: tps.h:25
SentTps()
Definition: tps.h:26
bool isRedundant() const override
Definition: tps.h:29
void grabPedalIsUp()
Definition: tps.cpp:23
constexpr int convertVoltageTo10bitADC(float voltage)
Definition: tps.h:21
bool isDigitalTps1()
Definition: init_tps.cpp:198
bool isTps1Error()
Definition: tps.cpp:38
void grabTPSIsWideOpen()
Definition: tps.cpp:15
bool isTps2Error()
Definition: tps.cpp:42
void grabTPSIsClosed()
Definition: tps.cpp:7
bool isPedalError()
Definition: tps.cpp:46
void sentTpsDecode()
Definition: tps.cpp:63
float decodeTpsSentValue(float sentValue)
Definition: tps.cpp:52
void grabPedalIsWideOpen()
Definition: tps.cpp:32