mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
b695d36d28
commit
ae7820f863
|
@ -51,6 +51,8 @@ void setDodgeNeon1995EngineConfiguration(engine_configuration_s *engineConfigura
|
||||||
|
|
||||||
engineConfiguration->algorithm = LM_ALPHA_N;
|
engineConfiguration->algorithm = LM_ALPHA_N;
|
||||||
|
|
||||||
|
engineConfiguration->hasIatSensor = false;
|
||||||
|
|
||||||
// set_rpm_hard_limit 4000
|
// set_rpm_hard_limit 4000
|
||||||
engineConfiguration->rpmHardLimit = 4000; // yes, 4k. let's play it safe for now
|
engineConfiguration->rpmHardLimit = 4000; // yes, 4k. let's play it safe for now
|
||||||
// set_cranking_rpm 550
|
// set_cranking_rpm 550
|
||||||
|
|
|
@ -44,6 +44,8 @@ class engine_configuration2_s {
|
||||||
public:
|
public:
|
||||||
engine_configuration2_s();
|
engine_configuration2_s();
|
||||||
|
|
||||||
|
engine_configuration_s *engineConfiguration;
|
||||||
|
|
||||||
Thermistor iat;
|
Thermistor iat;
|
||||||
Thermistor clt;
|
Thermistor clt;
|
||||||
|
|
||||||
|
|
|
@ -240,8 +240,10 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
|
||||||
|
|
||||||
engineConfiguration->diffLoadEnrichmentCoef = 1;
|
engineConfiguration->diffLoadEnrichmentCoef = 1;
|
||||||
|
|
||||||
engineConfiguration->hasMapSensor = TRUE;
|
engineConfiguration->hasMapSensor = true;
|
||||||
engineConfiguration->hasCltSensor = TRUE;
|
engineConfiguration->hasAfrSensor = true;
|
||||||
|
engineConfiguration->hasCltSensor = true;
|
||||||
|
engineConfiguration->hasBaroSensor = false;
|
||||||
|
|
||||||
boardConfiguration->idleSolenoidFrequency = 200;
|
boardConfiguration->idleSolenoidFrequency = 200;
|
||||||
// engineConfiguration->idleMode = IM_AUTO;
|
// engineConfiguration->idleMode = IM_AUTO;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "sensor_types.h"
|
#include "sensor_types.h"
|
||||||
#include "can_header.h"
|
#include "can_header.h"
|
||||||
#include "rusefi_enums.h"
|
#include "rusefi_enums.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
#define MOCK_UNDEFINED -1
|
#define MOCK_UNDEFINED -1
|
||||||
|
|
||||||
|
@ -422,7 +423,11 @@ typedef struct {
|
||||||
|
|
||||||
board_configuration_s bc;
|
board_configuration_s bc;
|
||||||
|
|
||||||
int hasMapSensor;
|
bool_t hasMapSensor : 1; // bit 0
|
||||||
|
bool_t hasIatSensor : 1; // bit 1
|
||||||
|
bool_t hasBaroSensor : 1; // bit 1
|
||||||
|
bool_t hasAfrSensor : 1; // bit 2
|
||||||
|
// that's the next 32 bit field
|
||||||
int hasCltSensor;
|
int hasCltSensor;
|
||||||
|
|
||||||
idle_mode_e idleMode;
|
idle_mode_e idleMode;
|
||||||
|
|
|
@ -189,11 +189,10 @@ static void cylinderCleanupControl(Engine *engine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleGpio(Engine *engine, int index) {
|
static void handleGpio(Engine *engine, int index) {
|
||||||
if(boardConfiguration->gpioPins[index]==GPIO_NONE)
|
if (boardConfiguration->gpioPins[index] == GPIO_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
io_pin_e pin = (io_pin_e)((int)GPIO_0 + index);
|
io_pin_e pin = (io_pin_e) ((int) GPIO_0 + index);
|
||||||
|
|
||||||
|
|
||||||
int value = calc.getValue2(fuelPumpLogic, engine);
|
int value = calc.getValue2(fuelPumpLogic, engine);
|
||||||
if (value != getOutputPinValue(pin)) {
|
if (value != getOutputPinValue(pin)) {
|
||||||
|
@ -245,13 +244,13 @@ static void onEvenyGeneralMilliseconds(Engine *engine) {
|
||||||
|
|
||||||
// schedule next invocation
|
// schedule next invocation
|
||||||
chVTSetAny(&everyMsTimer, boardConfiguration->generalPeriodicThreadPeriod * TICKS_IN_MS,
|
chVTSetAny(&everyMsTimer, boardConfiguration->generalPeriodicThreadPeriod * TICKS_IN_MS,
|
||||||
(vtfunc_t)&onEvenyGeneralMilliseconds, engine);
|
(vtfunc_t) &onEvenyGeneralMilliseconds, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initPeriodicEvents(Engine *engine) {
|
static void initPeriodicEvents(Engine *engine) {
|
||||||
// schedule first invocation
|
// schedule first invocation
|
||||||
chVTSetAny(&everyMsTimer, boardConfiguration->generalPeriodicThreadPeriod * TICKS_IN_MS,
|
chVTSetAny(&everyMsTimer, boardConfiguration->generalPeriodicThreadPeriod * TICKS_IN_MS,
|
||||||
(vtfunc_t)&onEvenyGeneralMilliseconds, engine);
|
(vtfunc_t) &onEvenyGeneralMilliseconds, engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static void fuelPumpOff(void *arg) {
|
//static void fuelPumpOff(void *arg) {
|
||||||
|
@ -303,11 +302,15 @@ static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) {
|
||||||
static void printAnalogInfo(void) {
|
static void printAnalogInfo(void) {
|
||||||
printAnalogChannelInfo("TPS", engineConfiguration->tpsAdcChannel);
|
printAnalogChannelInfo("TPS", engineConfiguration->tpsAdcChannel);
|
||||||
printAnalogChannelInfo("CLT", engineConfiguration->cltAdcChannel);
|
printAnalogChannelInfo("CLT", engineConfiguration->cltAdcChannel);
|
||||||
printAnalogChannelInfo("IAT", engineConfiguration->iatAdcChannel);
|
if (engineConfiguration->hasIatSensor) {
|
||||||
|
printAnalogChannelInfo("IAT", engineConfiguration->iatAdcChannel);
|
||||||
|
}
|
||||||
printAnalogChannelInfo("MAF", engineConfiguration->mafAdcChannel);
|
printAnalogChannelInfo("MAF", engineConfiguration->mafAdcChannel);
|
||||||
printAnalogChannelInfo("AFR", engineConfiguration->afrSensor.afrAdcChannel);
|
printAnalogChannelInfo("AFR", engineConfiguration->afrSensor.afrAdcChannel);
|
||||||
printAnalogChannelInfo("MAP", engineConfiguration->map.sensor.hwChannel);
|
printAnalogChannelInfo("MAP", engineConfiguration->map.sensor.hwChannel);
|
||||||
printAnalogChannelInfo("BARO", engineConfiguration->baroSensor.hwChannel);
|
if (engineConfiguration->hasBaroSensor) {
|
||||||
|
printAnalogChannelInfo("BARO", engineConfiguration->baroSensor.hwChannel);
|
||||||
|
}
|
||||||
printAnalogChannelInfoExt("Vbatt", engineConfiguration->vbattAdcChannel, getVBatt());
|
printAnalogChannelInfoExt("Vbatt", engineConfiguration->vbattAdcChannel, getVBatt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +424,7 @@ void initEngineContoller(Engine *engine) {
|
||||||
|
|
||||||
//mySetPadMode2("user-defined", boardConfiguration->gpioPins[i], PAL_STM32_MODE_OUTPUT);
|
//mySetPadMode2("user-defined", boardConfiguration->gpioPins[i], PAL_STM32_MODE_OUTPUT);
|
||||||
|
|
||||||
io_pin_e pin = (io_pin_e)((int)GPIO_0 + i);
|
io_pin_e pin = (io_pin_e) ((int) GPIO_0 + i);
|
||||||
outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->gpioPins[i], &d);
|
outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->gpioPins[i], &d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ float getR1InVoltageDividor(float Vout, float Vin, float r2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float getR2InVoltageDividor(float Vout, float Vin, float r1) {
|
float getR2InVoltageDividor(float Vout, float Vin, float r1) {
|
||||||
if (Vout == 0) {
|
if (Vout == 0) {
|
||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
return r1 / (Vin / Vout - 1);
|
return r1 / (Vin / Vout - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,9 @@ bool isValidIntakeAirTemperature(float temperature) {
|
||||||
float getCoolantTemperature(engine_configuration2_s * engineConfiguration2) {
|
float getCoolantTemperature(engine_configuration2_s * engineConfiguration2) {
|
||||||
float temperature = getTemperatureC(&engineConfiguration2->clt);
|
float temperature = getTemperatureC(&engineConfiguration2->clt);
|
||||||
if (!isValidCoolantTemperature(temperature)) {
|
if (!isValidCoolantTemperature(temperature)) {
|
||||||
warning(OBD_PCM_Processor_Fault, "unrealistic CLT %f", temperature);
|
if (engineConfiguration2->engineConfiguration->hasCltSensor) {
|
||||||
|
warning(OBD_PCM_Processor_Fault, "unrealistic CLT %f", temperature);
|
||||||
|
}
|
||||||
return LIMPING_MODE_CLT_TEMPERATURE;
|
return LIMPING_MODE_CLT_TEMPERATURE;
|
||||||
}
|
}
|
||||||
return temperature;
|
return temperature;
|
||||||
|
@ -155,7 +157,9 @@ void prepareThermistorCurve(ThermistorConf * config) {
|
||||||
float getIntakeAirTemperature(engine_configuration2_s * engineConfiguration2) {
|
float getIntakeAirTemperature(engine_configuration2_s * engineConfiguration2) {
|
||||||
float temperature = getTemperatureC(&engineConfiguration2->iat);
|
float temperature = getTemperatureC(&engineConfiguration2->iat);
|
||||||
if (!isValidIntakeAirTemperature(temperature)) {
|
if (!isValidIntakeAirTemperature(temperature)) {
|
||||||
warning(OBD_PCM_Processor_Fault, "unrealistic IAT %f", temperature);
|
if (engineConfiguration2->engineConfiguration->hasIatSensor) {
|
||||||
|
warning(OBD_PCM_Processor_Fault, "unrealistic IAT %f", temperature);
|
||||||
|
}
|
||||||
return LIMPING_MODE_IAT_TEMPERATURE;
|
return LIMPING_MODE_IAT_TEMPERATURE;
|
||||||
}
|
}
|
||||||
return temperature;
|
return temperature;
|
||||||
|
|
|
@ -143,7 +143,7 @@ void runRusEfi(void) {
|
||||||
// that's dirty, this assignment should be nicer or in a better spot
|
// that's dirty, this assignment should be nicer or in a better spot
|
||||||
engine.engineConfiguration = engineConfiguration;
|
engine.engineConfiguration = engineConfiguration;
|
||||||
engine.engineConfiguration2 = engineConfiguration2;
|
engine.engineConfiguration2 = engineConfiguration2;
|
||||||
|
engineConfiguration2->engineConfiguration = engineConfiguration;
|
||||||
|
|
||||||
|
|
||||||
initErrorHandling();
|
initErrorHandling();
|
||||||
|
|
Loading…
Reference in New Issue