2014-10-05 11:03:00 -07:00
|
|
|
/**
|
|
|
|
* @file le_functions.cpp
|
|
|
|
*
|
|
|
|
* @date Oct 5, 2014
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
#include "le_functions.h"
|
|
|
|
#include "allsensors.h"
|
2014-10-06 00:03:15 -07:00
|
|
|
#include "rpm_calculator.h"
|
2014-10-05 11:03:00 -07:00
|
|
|
|
2014-10-05 14:03:04 -07:00
|
|
|
extern LENameOrdinalPair * LE_FIRST;
|
|
|
|
|
2014-10-09 00:02:51 -07:00
|
|
|
static LENameOrdinalPair leLess(LE_OPERATOR_LESS, "<");
|
|
|
|
static LENameOrdinalPair leLessEquals(LE_OPERATOR_LESS_OR_EQUAL, "<=");
|
|
|
|
static LENameOrdinalPair leMore(LE_OPERATOR_MORE, ">");
|
|
|
|
static LENameOrdinalPair leMoreEquals(LE_OPERATOR_MORE_OR_EQUAL, ">=");
|
2014-10-05 14:03:04 -07:00
|
|
|
static LENameOrdinalPair leRpm(LE_METHOD_RPM, "rpm");
|
2014-10-06 00:03:15 -07:00
|
|
|
static LENameOrdinalPair leTps(LE_METHOD_TPS, "tps");
|
|
|
|
static LENameOrdinalPair leMaf(LE_METHOD_MAF, "maf");
|
2014-11-06 10:04:30 -08:00
|
|
|
static LENameOrdinalPair leVBatt(LE_METHOD_VBATT, "vbatt");
|
2014-10-05 14:03:04 -07:00
|
|
|
static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
|
|
|
|
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
|
|
|
|
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting");
|
|
|
|
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting");
|
2014-10-06 02:03:01 -07:00
|
|
|
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot");
|
2014-10-05 14:03:04 -07:00
|
|
|
|
2014-10-05 11:03:00 -07:00
|
|
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
|
|
|
float getLEValue(Engine *engine, le_action_e action) {
|
2014-10-09 00:02:51 -07:00
|
|
|
efiAssert(engine!=NULL, "getLEValue", NAN);
|
|
|
|
switch (action) {
|
2014-10-05 11:03:00 -07:00
|
|
|
// case LE_METHOD_FAN:
|
|
|
|
// return ;
|
|
|
|
case LE_METHOD_COOLANT:
|
2014-10-31 12:03:00 -07:00
|
|
|
return getCoolantTemperature(engine);
|
2014-10-06 00:03:15 -07:00
|
|
|
case LE_METHOD_INTAKE_AIR:
|
2014-10-31 12:03:00 -07:00
|
|
|
return getIntakeAirTemperature(engine);
|
2014-10-06 00:03:15 -07:00
|
|
|
case LE_METHOD_RPM:
|
2014-11-11 13:05:09 -08:00
|
|
|
return engine->rpmCalculator.rpm();
|
2014-10-06 00:03:15 -07:00
|
|
|
case LE_METHOD_TIME_SINCE_BOOT:
|
|
|
|
return getTimeNowSeconds();
|
2014-11-06 10:04:30 -08:00
|
|
|
case LE_METHOD_FAN_OFF_SETTING:
|
|
|
|
return engine->engineConfiguration->fanOffTemperature;
|
|
|
|
case LE_METHOD_FAN_ON_SETTING:
|
|
|
|
return engine->engineConfiguration->fanOnTemperature;
|
|
|
|
case LE_METHOD_VBATT:
|
|
|
|
return getVBatt(engine->engineConfiguration);
|
2014-10-05 11:03:00 -07:00
|
|
|
default:
|
|
|
|
firmwareError("No value for %d", action);
|
2014-10-05 12:03:09 -07:00
|
|
|
return NAN;
|
2014-10-05 11:03:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|