rusefi-1/firmware/controllers/sensors/map.h

38 lines
1.1 KiB
C
Raw Normal View History

2015-12-31 13:02:30 -08:00
/**
2018-01-21 13:11:39 -08:00
* @file map.h
*
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-12-31 13:02:30 -08:00
*/
2015-07-10 06:01:56 -07:00
#ifndef MAP_H_
#define MAP_H_
#include "engine_configuration.h"
2017-05-15 20:33:22 -07:00
void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
2015-07-10 06:01:56 -07:00
/**
* @return Raw MAP sensor value right now
*/
2017-05-15 20:33:22 -07:00
float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float getBaroPressure(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool hasBaroSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
bool hasMapSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2016-12-17 08:01:40 -08:00
2015-07-10 06:01:56 -07:00
/**
* @return MAP value averaged within a window of measurement
*/
float getMap(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2017-05-15 20:33:22 -07:00
float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX);
2015-07-10 06:01:56 -07:00
2018-01-21 13:11:39 -08:00
#define KPA_PER_PSI 6.89475728
// PSI (relative to atmosphere) to kPa (relative to vacuum)
#define PSI2KPA(psi) (101.32500411216164 + KPA_PER_PSI * (psi))
#define INHG2KPA(inhg) ((inhg) * 3.386375)
2016-06-26 11:01:41 -07:00
#define KPA2INHG(kpa) ((kpa) / 3.386375)
2015-07-10 06:01:56 -07:00
#endif