only:shall we be just a little less Toyota
This commit is contained in:
parent
198c9e8f57
commit
2e62e6fc91
|
@ -138,18 +138,18 @@ void EngineState::periodicFastCallback() {
|
||||||
auto tps = Sensor::get(SensorType::Tps1);
|
auto tps = Sensor::get(SensorType::Tps1);
|
||||||
updateTChargeK(rpm, tps.value_or(0));
|
updateTChargeK(rpm, tps.value_or(0));
|
||||||
|
|
||||||
float injectionMass = getInjectionMass(rpm) * engine->engineState.lua.fuelMult + engine->engineState.lua.fuelAdd;
|
float l_injectionMass = getInjectionMass(rpm) * engine->engineState.lua.fuelMult + engine->engineState.lua.fuelAdd;
|
||||||
auto clResult = fuelClosedLoopCorrection();
|
auto clResult = fuelClosedLoopCorrection();
|
||||||
|
|
||||||
// Store the pre-wall wetting injection duration for scheduling purposes only, not the actual injection duration
|
// Store the pre-wall wetting injection duration for scheduling purposes only, not the actual injection duration
|
||||||
engine->engineState.injectionDuration = engine->module<InjectorModel>()->getInjectionDuration(injectionMass);
|
engine->engineState.injectionDuration = engine->module<InjectorModel>()->getInjectionDuration(l_injectionMass);
|
||||||
|
|
||||||
float fuelLoad = getFuelingLoad();
|
float fuelLoad = getFuelingLoad();
|
||||||
injectionOffset = getInjectionOffset(rpm, fuelLoad);
|
injectionOffset = getInjectionOffset(rpm, fuelLoad);
|
||||||
engine->lambdaMonitor.update(rpm, fuelLoad);
|
engine->lambdaMonitor.update(rpm, fuelLoad);
|
||||||
|
|
||||||
float ignitionLoad = getIgnitionLoad();
|
float l_ignitionLoad = getIgnitionLoad();
|
||||||
float baseAdvance = getAdvance(rpm, ignitionLoad) * engine->ignitionState.luaTimingMult + engine->ignitionState.luaTimingAdd;
|
float baseAdvance = getAdvance(rpm, l_ignitionLoad) * engine->ignitionState.luaTimingMult + engine->ignitionState.luaTimingAdd;
|
||||||
float correctedIgnitionAdvance = baseAdvance
|
float correctedIgnitionAdvance = baseAdvance
|
||||||
// Pull any extra timing for knock retard
|
// Pull any extra timing for knock retard
|
||||||
- engine->module<KnockController>()->getKnockRetard()
|
- engine->module<KnockController>()->getKnockRetard()
|
||||||
|
@ -173,9 +173,9 @@ void EngineState::periodicFastCallback() {
|
||||||
auto cylinderTrim = getCylinderFuelTrim(i, rpm, fuelLoad);
|
auto cylinderTrim = getCylinderFuelTrim(i, rpm, fuelLoad);
|
||||||
|
|
||||||
// Apply both per-bank and per-cylinder trims
|
// Apply both per-bank and per-cylinder trims
|
||||||
engine->engineState.injectionMass[i] = injectionMass * bankTrim * cylinderTrim;
|
engine->engineState.injectionMass[i] = l_injectionMass * bankTrim * cylinderTrim;
|
||||||
|
|
||||||
timingAdvance[i] = correctedIgnitionAdvance + getCombinedCylinderIgnitionTrim(i, rpm, ignitionLoad);
|
timingAdvance[i] = correctedIgnitionAdvance + getCombinedCylinderIgnitionTrim(i, rpm, l_ignitionLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldUpdateInjectionTiming = getInjectorDutyCycle(rpm) < 90;
|
shouldUpdateInjectionTiming = getInjectorDutyCycle(rpm) < 90;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
static int addMafPoint(persistent_config_s *config, int index, float kgHrValue, float voltage) {
|
static int addMafPoint(persistent_config_s *p_config, int index, float kgHrValue, float voltage) {
|
||||||
config->mafDecoding[index] = kgHrValue;
|
p_config->mafDecoding[index] = kgHrValue;
|
||||||
config->mafDecodingBins[index] = voltage;
|
p_config->mafDecodingBins[index] = voltage;
|
||||||
return index + 1;
|
return index + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int addMafPointByVoltage(persistent_config_s *config, int index, float voltage, float kgHrValue) {
|
static int addMafPointByVoltage(persistent_config_s *p_config, int index, float voltage, float kgHrValue) {
|
||||||
return addMafPoint(config, index, kgHrValue, voltage);
|
return addMafPoint(p_config, index, kgHrValue, voltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fillTheRest(persistent_config_s *e, int i) {
|
static void fillTheRest(persistent_config_s *e, int i) {
|
||||||
|
|
|
@ -54,10 +54,10 @@ float getVoltage(const char *msg, adc_channel_e hwChannel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_USE_FAST_ADC
|
#if EFI_USE_FAST_ADC
|
||||||
AdcDevice::AdcDevice(ADCConversionGroup* hwConfig, adcsample_t *buf, size_t buf_len) {
|
AdcDevice::AdcDevice(ADCConversionGroup* p_hwConfig, adcsample_t *p_buf, size_t p_buf_len) {
|
||||||
this->hwConfig = hwConfig;
|
this->hwConfig = p_hwConfig;
|
||||||
this->samples = buf;
|
this->samples = p_buf;
|
||||||
this->buf_len = buf_len;
|
this->buf_len = p_buf_len;
|
||||||
|
|
||||||
hwConfig->sqr1 = 0;
|
hwConfig->sqr1 = 0;
|
||||||
hwConfig->sqr2 = 0;
|
hwConfig->sqr2 = 0;
|
||||||
|
|
|
@ -31,10 +31,10 @@ void Ads1015::readChannels(float (&result)[4]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Ads1015::readChannel(uint8_t ch) {
|
float Ads1015::readChannel(uint8_t channel) {
|
||||||
// set the channel
|
// set the channel
|
||||||
// set to +-6.144v full scale, fastest sampling, manual conversion start
|
// set to +-6.144v full scale, fastest sampling, manual conversion start
|
||||||
writeReg(ADS1015_CONFIG, 0xC1E0 | ch << 12);
|
writeReg(ADS1015_CONFIG, 0xC1E0 | channel << 12);
|
||||||
|
|
||||||
// Wait for conversion to complete
|
// Wait for conversion to complete
|
||||||
// Bit is cleared while conversion is ongoing, set when done
|
// Bit is cleared while conversion is ongoing, set when done
|
||||||
|
|
|
@ -89,8 +89,7 @@ void unlockSpi(spi_device_e device) {
|
||||||
spiReleaseBus(getSpiDevice(device));
|
spiReleaseBus(getSpiDevice(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initSpiModules(engine_configuration_s *engineConfiguration) {
|
static void initSpiModules() {
|
||||||
UNUSED(engineConfiguration);
|
|
||||||
if (engineConfiguration->is_enabled_spi_1) {
|
if (engineConfiguration->is_enabled_spi_1) {
|
||||||
turnOnSpi(SPI_DEVICE_1);
|
turnOnSpi(SPI_DEVICE_1);
|
||||||
}
|
}
|
||||||
|
@ -209,8 +208,7 @@ static void calcFastAdcIndexes() {
|
||||||
#endif/* HAL_USE_ADC */
|
#endif/* HAL_USE_ADC */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adcConfigListener(Engine *engine) {
|
static void adcConfigListener() {
|
||||||
UNUSED(engine);
|
|
||||||
// todo: something is not right here - looks like should be a callback for each configuration change?
|
// todo: something is not right here - looks like should be a callback for each configuration change?
|
||||||
calcFastAdcIndexes();
|
calcFastAdcIndexes();
|
||||||
}
|
}
|
||||||
|
@ -359,7 +357,7 @@ void applyNewHardwareSettings() {
|
||||||
startSent();
|
startSent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
adcConfigListener(engine);
|
adcConfigListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_BOR_LEVEL
|
#if EFI_BOR_LEVEL
|
||||||
|
@ -508,7 +506,7 @@ void initHardware() {
|
||||||
#endif // TRIGGER_SCOPE
|
#endif // TRIGGER_SCOPE
|
||||||
|
|
||||||
#if HAL_USE_SPI
|
#if HAL_USE_SPI
|
||||||
initSpiModules(engineConfiguration);
|
initSpiModules();
|
||||||
#endif /* HAL_USE_SPI */
|
#endif /* HAL_USE_SPI */
|
||||||
|
|
||||||
#if (EFI_PROD_CODE && BOARD_EXT_GPIOCHIPS > 0) || EFI_SIMULATOR
|
#if (EFI_PROD_CODE && BOARD_EXT_GPIOCHIPS > 0) || EFI_SIMULATOR
|
||||||
|
|
Loading…
Reference in New Issue