making either Matt or compiler or both happier
This commit is contained in:
parent
d80c1f0b1e
commit
19c410387d
|
@ -114,7 +114,7 @@ float AccelEnrichmemnt::getMaxDelta(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
int index = getMaxDeltaIndex(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
// FuelSchedule *fs = engine->engineConfiguration2->injectionEvents;
|
||||
// FuelSchedule *fs = engine->engineConfigurationPtr2->injectionEvents;
|
||||
float tpsTo = cb.get(index);
|
||||
float tpsFrom = cb.get(index - 1);
|
||||
float d = tpsTo - tpsFrom;
|
||||
|
|
|
@ -187,7 +187,8 @@ void Engine::reset() {
|
|||
injectionDuration = 0;
|
||||
clutchDownState = clutchUpState = brakePedalState = false;
|
||||
memset(&m, 0, sizeof(m));
|
||||
|
||||
config = NULL;
|
||||
engineConfigurationPtr = NULL;
|
||||
}
|
||||
|
||||
FuelConsumptionState::FuelConsumptionState() {
|
||||
|
@ -369,13 +370,13 @@ void EngineState::updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUF
|
|||
* so that we can prepare some helper structures
|
||||
*/
|
||||
void Engine::preCalculate() {
|
||||
sparkTable.preCalc(engineConfiguration->sparkDwellRpmBins,
|
||||
engineConfiguration->sparkDwellValues);
|
||||
sparkTable.preCalc(engineConfigurationPtr->sparkDwellRpmBins,
|
||||
engineConfigurationPtr->sparkDwellValues);
|
||||
|
||||
#if ! EFI_UNIT_TEST
|
||||
adcToVoltageInputDividerCoefficient = adcToVolts(1) * engineConfiguration->analogInputDividerCoefficient;
|
||||
adcToVoltageInputDividerCoefficient = adcToVolts(1) * engineConfigurationPtr->analogInputDividerCoefficient;
|
||||
#else
|
||||
adcToVoltageInputDividerCoefficient = engineConfiguration->analogInputDividerCoefficient;
|
||||
adcToVoltageInputDividerCoefficient = engineConfigurationPtr->analogInputDividerCoefficient;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -391,7 +392,7 @@ void Engine::preCalculate() {
|
|||
|
||||
void Engine::setConfig(persistent_config_s *config) {
|
||||
this->config = config;
|
||||
engineConfiguration = &config->engineConfiguration;
|
||||
engineConfigurationPtr = &config->engineConfiguration;
|
||||
memset(config, 0, sizeof(persistent_config_s));
|
||||
engineState.warmupAfrPid.initPidClass(&config->engineConfiguration.warmupAfrPid);
|
||||
}
|
||||
|
@ -402,7 +403,7 @@ void Engine::printKnockState(void) {
|
|||
|
||||
void Engine::knockLogic(float knockVolts) {
|
||||
this->knockVolts = knockVolts;
|
||||
knockNow = knockVolts > engineConfiguration->knockVThreshold;
|
||||
knockNow = knockVolts > engineConfigurationPtr->knockVThreshold;
|
||||
/**
|
||||
* KnockCount is directly proportional to the degrees of ignition
|
||||
* advance removed
|
||||
|
@ -419,7 +420,7 @@ void Engine::knockLogic(float knockVolts) {
|
|||
if (knockNow) {
|
||||
knockEver = true;
|
||||
timeOfLastKnockEvent = getTimeNowUs();
|
||||
if (knockCount < engineConfiguration->maxKnockSubDeg)
|
||||
if (knockCount < engineConfigurationPtr->maxKnockSubDeg)
|
||||
knockCount++;
|
||||
} else if (knockCount >= 1) {
|
||||
knockCount--;
|
||||
|
|
|
@ -344,7 +344,10 @@ public:
|
|||
|
||||
RpmCalculator rpmCalculator;
|
||||
persistent_config_s *config;
|
||||
engine_configuration_s *engineConfiguration;
|
||||
/**
|
||||
* we use funny unique name to make sure that compiler is not confused between global variable and class member
|
||||
*/
|
||||
engine_configuration_s *engineConfigurationPtr;
|
||||
|
||||
/**
|
||||
* this is about 'stopengine' command
|
||||
|
|
|
@ -288,6 +288,7 @@ static void setDefaultFsioParameters(engine_configuration_s *engineConfiguration
|
|||
}
|
||||
|
||||
void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, engineConfiguration != NULL, "ec NULL");
|
||||
memset(engineConfiguration, 0, sizeof(engine_configuration_s));
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
|
|
|
@ -542,7 +542,7 @@ static void showFsioInfo(void) {
|
|||
scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%.2f", (i + 1), exp,
|
||||
hwPortname(boardConfiguration->fsioOutputPins[i]), boardConfiguration->fsioFrequency[i],
|
||||
engine->fsioLastValue[i]);
|
||||
// scheduleMsg(logger, "user-defined #%d value=%.2f", i, engine->engineConfiguration2->fsioLastValue[i]);
|
||||
// scheduleMsg(logger, "user-defined #%d value=%.2f", i, engine->engineConfigurationPtr2->fsioLastValue[i]);
|
||||
showFsio(NULL, fsioLogics[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -531,7 +531,7 @@ static void setFloat(const char *offsetStr, const char *valueStr) {
|
|||
scheduleMsg(&logger, "invalid value [%s]", valueStr);
|
||||
return;
|
||||
}
|
||||
float *ptr = (float *) (&((char *) engine->engineConfiguration)[offset]);
|
||||
float *ptr = (float *) (&((char *) engine->engineConfigurationPtr)[offset]);
|
||||
*ptr = value;
|
||||
getFloat(offset);
|
||||
}
|
||||
|
|
|
@ -26,5 +26,5 @@ bool getAcToggle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* for now we are looking for a pull-up. High level means input switch is floating (which is OFF position)
|
||||
* low value means input is ground - which means ON.
|
||||
*/
|
||||
return getVoltageDivided("A/C", engine->engineConfiguration->acSwitchAdc) < 2.5;
|
||||
return getVoltageDivided("A/C", engine->engineConfigurationPtr->acSwitchAdc) < 2.5;
|
||||
}
|
||||
|
|
|
@ -87,13 +87,13 @@ extern TunerStudioOutputChannels tsOutputChannels;
|
|||
//#endif
|
||||
|
||||
void startSimultaniousInjection(Engine *engine) {
|
||||
for (int i = 0; i < engine->engineConfiguration->specs.cylindersCount; i++) {
|
||||
for (int i = 0; i < engine->engineConfigurationPtr->specs.cylindersCount; i++) {
|
||||
enginePins.injectors[i].setHigh();
|
||||
}
|
||||
}
|
||||
|
||||
static void endSimultaniousInjectionOnlyTogglePins(Engine *engine) {
|
||||
for (int i = 0; i < engine->engineConfiguration->specs.cylindersCount; i++) {
|
||||
for (int i = 0; i < engine->engineConfigurationPtr->specs.cylindersCount; i++) {
|
||||
enginePins.injectors[i].setLow();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ void initEngineEmulator(Logging *sharedLogger, Engine *engine) {
|
|||
|
||||
#if EFI_POTENTIOMETER
|
||||
#if HAL_USE_SPI || defined(__DOXYGEN__)
|
||||
initPotentiometers(sharedLogger, &engine->engineConfiguration->bc);
|
||||
initPotentiometers(sharedLogger, &engine->engineConfigurationPtr->bc);
|
||||
#endif /* HAL_USE_SPI */
|
||||
#endif /* EFI_POTENTIOMETER */
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ void showBor(void) {
|
|||
void initHardware(Logging *l) {
|
||||
efiAssertVoid(CUSTOM_IH_STACK, getRemainingStack(chThdGetSelfX()) > 256, "init h");
|
||||
sharedLogger = l;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr;
|
||||
efiAssertVoid(CUSTOM_EC_NULL, engineConfiguration!=NULL, "engineConfiguration");
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
|
|
|
@ -31,10 +31,11 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
|
|||
schedulingQueue.clear();
|
||||
enginePins.reset();
|
||||
|
||||
Engine *engine = &this->engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
board_configuration_s * boardConfiguration = &persistentConfig.engineConfiguration.bc;
|
||||
persistent_config_s *config = &persistentConfig;
|
||||
Engine *engine = &this->engine;
|
||||
engine->setConfig(config);
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr;
|
||||
board_configuration_s * boardConfiguration = &persistentConfig.engineConfiguration.bc;
|
||||
|
||||
setCurveValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);
|
||||
setCurveValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -30, 1.5);
|
||||
|
@ -57,7 +58,7 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persiste
|
|||
|
||||
resetConfigurationExt(NULL, engineType PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
prepareShapes(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
engine->engineConfiguration->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
|
||||
engine->engineConfigurationPtr->mafAdcChannel = (adc_channel_e)TEST_MAF_CHANNEL;
|
||||
|
||||
initThermistors(NULL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
// this is needed to have valid CLT and IAT.
|
||||
|
@ -76,8 +77,8 @@ void EngineTestHelper::fireRise(int delayMs) {
|
|||
}
|
||||
|
||||
void EngineTestHelper::firePrimaryTriggerRise() {
|
||||
board_configuration_s * boardConfiguration = &engine.engineConfiguration->bc;
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
board_configuration_s * boardConfiguration = &engine.engineConfigurationPtr->bc;
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_RISING, &engine, engine.engineConfigurationPtr, &persistentConfig, boardConfiguration);
|
||||
}
|
||||
|
||||
void EngineTestHelper::fireFall(int delayMs) {
|
||||
|
@ -86,8 +87,8 @@ void EngineTestHelper::fireFall(int delayMs) {
|
|||
}
|
||||
|
||||
void EngineTestHelper::firePrimaryTriggerFall() {
|
||||
board_configuration_s * boardConfiguration = &engine.engineConfiguration->bc;
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING, &engine, engine.engineConfiguration, &persistentConfig, boardConfiguration);
|
||||
board_configuration_s * boardConfiguration = &engine.engineConfigurationPtr->bc;
|
||||
engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_FALLING, &engine, engine.engineConfigurationPtr, &persistentConfig, boardConfiguration);
|
||||
}
|
||||
|
||||
void EngineTestHelper::fireTriggerEventsWithDuration(int durationMs) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class Engine;
|
|||
* if engine is in scope
|
||||
*/
|
||||
#define EXPAND_Engine \
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration; \
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \
|
||||
persistent_config_s *config = engine->config; \
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ void testCoastingFuelCut() {
|
|||
// set cranking threshold
|
||||
engineConfiguration->cranking.rpm = 999;
|
||||
// configure TPS
|
||||
eth.engine.engineConfiguration->tpsMin = 0;
|
||||
eth.engine.engineConfiguration->tpsMax = 10;
|
||||
eth.engine.engineConfigurationPtr->tpsMin = 0;
|
||||
eth.engine.engineConfigurationPtr->tpsMax = 10;
|
||||
|
||||
// basic engine setup
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
|
|
|
@ -61,8 +61,8 @@ void testFuelMap(void) {
|
|||
assertEqualsM("lag", 1.04, getInjectorLag(12 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
|
||||
eth.engine.engineConfiguration->injector.battLagCorrBins[i] = i;
|
||||
eth.engine.engineConfiguration->injector.battLagCorr[i] = 0.5 + 2 * i;
|
||||
eth.engine.engineConfigurationPtr->injector.battLagCorrBins[i] = i;
|
||||
eth.engine.engineConfigurationPtr->injector.battLagCorr[i] = 0.5 + 2 * i;
|
||||
}
|
||||
|
||||
eth.engine.updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -258,8 +258,8 @@ void testStartupFuelPumping(void) {
|
|||
|
||||
engine->rpmCalculator.mockRpm = 0;
|
||||
|
||||
engine->engineConfiguration->tpsMin = 0;
|
||||
engine->engineConfiguration->tpsMax = 10;
|
||||
engine->engineConfigurationPtr->tpsMin = 0;
|
||||
engine->engineConfigurationPtr->tpsMax = 10;
|
||||
|
||||
setMockTpsPosition(6);
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -834,7 +834,7 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
// {
|
||||
// scheduling_s *ev = schedulingQueue.getForUnitText(9);
|
||||
// assertEqualsM("rev cnt#4#2", 5, engine->rpmCalculator.getRevolutionCounter());
|
||||
// assertTrueM("down 50", ev == &engine->engineConfiguration2->fuelActuators[2].signalPair[1].signalTimerDown);
|
||||
// assertTrueM("down 50", ev == &engine->engineConfigurationPtr2->fuelActuators[2].signalPair[1].signalTimerDown);
|
||||
// }
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static void fireEvent(EngineTestHelper *eth, bool isRise) {
|
|||
// but for noise filtering, both edges should be processed, so we fire falling events too
|
||||
if (isRise)
|
||||
eth->firePrimaryTriggerRise();
|
||||
else if (eth->engine.engineConfiguration->bc.useNoiselessTriggerDecoder)
|
||||
else if (eth->engine.engineConfigurationPtr->bc.useNoiselessTriggerDecoder)
|
||||
eth->firePrimaryTriggerFall();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue