auto-sync
This commit is contained in:
parent
647cc2d586
commit
4940c0d226
|
@ -27,9 +27,7 @@
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
static Logging *logger;
|
static Logging *logger = NULL;
|
||||||
|
|
||||||
static bool initialized = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http://en.wikipedia.org/wiki/Voltage_divider
|
* http://en.wikipedia.org/wiki/Voltage_divider
|
||||||
|
@ -80,10 +78,6 @@ float getResistance(ThermistorConf *config, float voltage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float getTemperatureC(ThermistorConf *config, ThermistorMath *tm) {
|
float getTemperatureC(ThermistorConf *config, ThermistorMath *tm) {
|
||||||
if (!initialized) {
|
|
||||||
firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized");
|
|
||||||
return NAN;
|
|
||||||
}
|
|
||||||
tm->setConfig(&config->config); // implementation checks if configuration has changed or not
|
tm->setConfig(&config->config); // implementation checks if configuration has changed or not
|
||||||
|
|
||||||
float voltage = getVoltageDivided("term", config->adcChannel);
|
float voltage = getVoltageDivided("term", config->adcChannel);
|
||||||
|
@ -212,8 +206,13 @@ void setCommonNTCSensor(ThermistorConf *thermistorConf) {
|
||||||
setThermistorConfiguration(thermistorConf, -20, 18000, 23.8889, 2100, 120.0, 100.0);
|
setThermistorConfiguration(thermistorConf, -20, 18000, 23.8889, 2100, 120.0, 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
static void testCltByR(float resistance) {
|
static void testCltByR(float resistance) {
|
||||||
|
if (logger == NULL) {
|
||||||
|
firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// we expect slowPeriodicCallback to already update configuration in the curve helper class see setConfig
|
// we expect slowPeriodicCallback to already update configuration in the curve helper class see setConfig
|
||||||
float kTemp = engine->engineState.cltCurve.getKelvinTemperatureByResistance(resistance);
|
float kTemp = engine->engineState.cltCurve.getKelvinTemperatureByResistance(resistance);
|
||||||
scheduleMsg(logger, "for R=%f we have %f", resistance, (kTemp - KELV));
|
scheduleMsg(logger, "for R=%f we have %f", resistance, (kTemp - KELV));
|
||||||
|
@ -227,8 +226,6 @@ void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
addConsoleActionF("test_clt_by_r", testCltByR);
|
addConsoleActionF("test_clt_by_r", testCltByR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermistorMath::ThermistorMath() {
|
ThermistorMath::ThermistorMath() {
|
||||||
|
|
|
@ -22,7 +22,8 @@ static int joyB = 0;
|
||||||
static int joyC = 0;
|
static int joyC = 0;
|
||||||
static int joyD = 0;
|
static int joyD = 0;
|
||||||
|
|
||||||
#define NT_EVENT_GAP US2NT(1000)
|
// 50ms
|
||||||
|
#define NT_EVENT_GAP US2NT(50 *1000)
|
||||||
|
|
||||||
static Logging *sharedLogger;
|
static Logging *sharedLogger;
|
||||||
static efitick_t lastEventTime = 0;
|
static efitick_t lastEventTime = 0;
|
||||||
|
|
Loading…
Reference in New Issue