2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file tps.h
|
|
|
|
* @brief
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @date Nov 15, 2013
|
2017-01-03 03:05:22 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2017
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TPS_H_
|
|
|
|
#define TPS_H_
|
|
|
|
|
|
|
|
#include "global.h"
|
|
|
|
#include "engine_configuration.h"
|
|
|
|
|
2016-01-31 18:02:03 -08:00
|
|
|
// we have 12 bit precision and TS uses 10 bit precision
|
|
|
|
#define TPS_TS_CONVERSION 4
|
|
|
|
|
2017-05-15 20:33:22 -07:00
|
|
|
bool hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* Throttle Position Sensor
|
|
|
|
* In case of dual TPS this function would return logical TPS position
|
|
|
|
* @return Current TPS position, percent of WOT. 0 means idle and 100 means Wide Open Throttle
|
|
|
|
*/
|
2017-05-15 20:33:22 -07:00
|
|
|
percent_t getTPS(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
bool hasTpsSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
int convertVoltageTo10bitADC(float voltage);
|
2017-05-15 20:33:22 -07:00
|
|
|
int getTPS12bitAdc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2019-04-29 22:21:09 -07:00
|
|
|
#define getTPS10bitAdc() (getTPS12bitAdc() / TPS_TS_CONVERSION)
|
2017-05-15 20:33:22 -07:00
|
|
|
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|
|
|
percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2017-05-29 19:35:24 -07:00
|
|
|
void setBosch0280750009(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2017-11-16 07:29:40 -08:00
|
|
|
void setMockTpsPosition(percent_t tpsPosition);
|
2017-11-16 11:44:53 -08:00
|
|
|
void setMockPedalPosition(percent_t value);
|
2019-04-29 22:21:09 -07:00
|
|
|
void grabTPSIsClosed();
|
|
|
|
void grabTPSIsWideOpen();
|
2019-04-30 15:46:39 -07:00
|
|
|
void grabPedalIsUp();
|
|
|
|
void grabPedalIsWideOpen();
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
typedef struct {
|
2016-02-04 11:01:38 -08:00
|
|
|
efitimeus_t prevTime;
|
2015-07-10 06:01:56 -07:00
|
|
|
// value 0-100%
|
|
|
|
float prevValue;
|
2016-02-04 11:01:38 -08:00
|
|
|
efitimeus_t curTime;
|
2015-07-10 06:01:56 -07:00
|
|
|
// value 0-100%
|
|
|
|
float curValue;
|
|
|
|
// % per second
|
|
|
|
float rateOfChange;
|
|
|
|
} tps_roc_s;
|
|
|
|
|
2016-02-04 11:01:38 -08:00
|
|
|
//void saveTpsState(efitimeus_t now, float curValue);
|
2015-07-10 06:01:56 -07:00
|
|
|
float getTpsRateOfChange(void);
|
|
|
|
|
|
|
|
#endif
|