docs/type safety
This commit is contained in:
parent
6c08eec9ad
commit
b14757c4db
|
@ -61,6 +61,8 @@ typedef efitime_t efitick_t;
|
|||
|
||||
typedef float angle_t;
|
||||
|
||||
// temperature, in Celsius
|
||||
typedef float temperature_t;
|
||||
typedef float floatms_t;
|
||||
typedef float floatus_t;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ baroCorr_Map3D_t baroCorrMap("baro");
|
|||
#define tpMax 100
|
||||
// http://rusefi.com/math/t_charge.html
|
||||
/***panel:Charge Temperature*/
|
||||
float getTCharge(int rpm, float tps, float coolantTemp, float airTemp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
temperature_t getTCharge(int rpm, float tps, float coolantTemp, float airTemp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (cisnan(coolantTemp) || cisnan(airTemp)) {
|
||||
warning(CUSTOM_ERR_NAN_TCHARGE, "t-getTCharge NaN");
|
||||
return coolantTemp;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define gramm_second_to_cc_minute(gs) ((gs) / 0.0119997981)
|
||||
#define cc_minute_to_gramm_second(ccm) ((ccm) * 0.0119997981)
|
||||
|
||||
float getTCharge(int rpm, float tps, float coolantTemperature, float airTemperature DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
temperature_t getTCharge(int rpm, float tps, float coolantTemperature, float airTemperature DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float getCylinderAirMass(float volumetricEfficiency, float MAP, float tempK DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float sdMath(float airMass, float AFR DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
|
|
@ -56,11 +56,12 @@ float ThermistorMath::getKelvinTemperatureByResistance(float resistance) const {
|
|||
return 1 / (s_h_a + s_h_b * logR + s_h_c * logR * logR * logR);
|
||||
}
|
||||
|
||||
float convertCelsiustoF(float tempC) {
|
||||
/*
|
||||
float convertCelsiustoF(temperature_t tempC) {
|
||||
return tempC * 9 / 5 + 32;
|
||||
}
|
||||
|
||||
float convertFtoCelsius(float tempF) {
|
||||
temperature_t convertFtoCelsius(float tempF) {
|
||||
return (tempF - 32) / 9 * 5;
|
||||
}
|
||||
|
||||
|
@ -68,6 +69,7 @@ float convertKelvinToFahrenheit(float kelvin) {
|
|||
float tempC = convertKelvinToCelcius(kelvin);
|
||||
return convertCelsiustoF(tempC);
|
||||
}
|
||||
*/
|
||||
|
||||
float getResistance(ThermistorConf *config, float voltage) {
|
||||
efiAssert(CUSTOM_ERR_ASSERT, config != NULL, "thermistor config is null", NAN);
|
||||
|
@ -77,7 +79,7 @@ float getResistance(ThermistorConf *config, float voltage) {
|
|||
return resistance;
|
||||
}
|
||||
|
||||
float getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
temperature_t getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
tm->setConfig(&cfg->config); // implementation checks if configuration has changed or not
|
||||
|
||||
DISPLAY_TEXT(Analog_MCU_reads);
|
||||
|
@ -112,12 +114,12 @@ float getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DE
|
|||
return convertKelvinToCelcius(kelvinTemperature);
|
||||
}
|
||||
|
||||
bool isValidCoolantTemperature(float temperature) {
|
||||
bool isValidCoolantTemperature(temperature_t temperature) {
|
||||
// I hope magic constants are appropriate here
|
||||
return !cisnan(temperature) && temperature > -50 && temperature < 250;
|
||||
}
|
||||
|
||||
bool isValidIntakeAirTemperature(float temperature) {
|
||||
bool isValidIntakeAirTemperature(temperature_t temperature) {
|
||||
// I hope magic constants are appropriate here
|
||||
return !cisnan(temperature) && temperature > -50 && temperature < 100;
|
||||
}
|
||||
|
@ -129,7 +131,7 @@ bool hasCltSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
/**
|
||||
* @return coolant temperature, in Celsius
|
||||
*/
|
||||
float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
temperature_t getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
if (!hasCltSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
engine->isCltBroken = false;
|
||||
return NO_CLT_SENSOR_TEMPERATURE;
|
||||
|
@ -211,7 +213,7 @@ bool hasIatSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
/**
|
||||
* @return Celsius value
|
||||
*/
|
||||
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
temperature_t getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
if (!hasIatSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||
return NO_IAT_SENSOR_TEMPERATURE;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ float convertFtoCelcius(float tempF);
|
|||
|
||||
float getKelvinTemperature(float resistance, ThermistorMath *tm);
|
||||
float getResistance(ThermistorConf *cfg, float voltage);
|
||||
float getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool isValidCoolantTemperature(float temperature);
|
||||
float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool isValidIntakeAirTemperature(float temperature);
|
||||
temperature_t getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
temperature_t getCoolantTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool isValidCoolantTemperature(temperature_t temperature);
|
||||
temperature_t getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool isValidIntakeAirTemperature(temperature_t temperature);
|
||||
bool hasIatSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool hasCltSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue