kinetis asking for guard, also I've must have messed up something

This commit is contained in:
Andrey 2022-12-17 18:04:54 -05:00
parent 86c0a18a45
commit 748f97afeb
6 changed files with 24 additions and 2 deletions

View File

@ -140,7 +140,11 @@ const wall_fuel_state_s* getLiveData(size_t) {
template<>
const idle_state_s* getLiveData(size_t) {
#if EFI_IDLE_CONTROL
return &engine->module<IdleController>().unmock();
#else
return nullptr;
#endif
}
template<>

View File

@ -71,9 +71,11 @@ static void showIdleInfo() {
}
}
#if EFI_IDLE_CONTROL
if (engineConfiguration->idleMode == IM_AUTO) {
engine->module<IdleController>().unmock().getIdlePid()->showPidStatus("idle");
}
#endif // EFI_IDLE_CONTROL
}
void setIdleMode(idle_mode_e value) {
@ -101,7 +103,11 @@ static void startInputPinIfValid(const char *msg, brain_pin_e pin, pin_input_mod
#endif // EFI_PROD_CODE
percent_t getIdlePosition() {
#if EFI_IDLE_CONTROL
return engine->module<IdleController>().unmock().currentIdlePosition;
#else
return 0;
#endif
}
void startPedalPins() {
@ -130,7 +136,9 @@ void stopPedalPins() {
#if ! EFI_UNIT_TEST
static void applyPidSettings() {
#if EFI_IDLE_CONTROL
engine->module<IdleController>().unmock().getIdlePid()->updateFactors(engineConfiguration->idleRpmPid.pFactor, engineConfiguration->idleRpmPid.iFactor, engineConfiguration->idleRpmPid.dFactor);
#endif // EFI_IDLE_CONTROL
}
void setTargetIdleRpm(int value) {

View File

@ -63,6 +63,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) {
}
// get advance from the separate table for Idle
#if EFI_IDLE_CONTROL
if (engineConfiguration->useSeparateAdvanceForIdle &&
engine->module<IdleController>()->isIdlingOrTaper()) {
float idleAdvance = interpolate2d(rpm, config->idleAdvanceBins, config->idleAdvance);
@ -73,6 +74,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) {
advanceAngle = interpolateClamped(0.0f, idleAdvance, engineConfiguration->idlePidDeactivationTpsThreshold, advanceAngle, tps.Value);
}
}
#endif
#if EFI_LAUNCH_CONTROL
if (engine->launchController.isLaunchCondition && engineConfiguration->enableLaunchRetard) {
@ -104,11 +106,11 @@ angle_t getAdvanceCorrections(int rpm) {
);
}
#if EFI_SHAFT_POSITION_INPUT
#if EFI_SHAFT_POSITION_INPUT && EFI_IDLE_CONTROL
float instantRpm = engine->triggerCentral.instantRpm.getInstantRpm();
engine->engineState.timingPidCorrection = engine->module<IdleController>()->getIdleTimingAdjustment(instantRpm);
#endif // EFI_SHAFT_POSITION_INPUT
#endif // EFI_SHAFT_POSITION_INPUT && EFI_IDLE_CONTROL
#if EFI_TUNER_STUDIO
engine->outputChannels.multiSparkCounter = engine->engineState.multispark.count;

View File

@ -22,6 +22,7 @@ float AirmassVeModelBase::getVe(int rpm, float load) const {
percent_t ve = m_veTable->getValue(rpm, load);
#if EFI_IDLE_CONTROL
auto tps = Sensor::get(SensorType::Tps1);
// get VE from the separate table for Idle if idling
if (engine->module<IdleController>()->isIdlingOrTaper() &&
@ -34,6 +35,7 @@ float AirmassVeModelBase::getVe(int rpm, float load) const {
// interpolate between idle table and normal (running) table using TPS threshold
ve = interpolateClamped(0.0f, idleVe, engineConfiguration->idlePidDeactivationTpsThreshold, ve, tps.Value);
}
#endif // EFI_IDLE_CONTROL
// Add any adjustments if configured
for (size_t i = 0; i < efi::size(config->veBlends); i++) {

View File

@ -253,9 +253,11 @@ void Engine::updateSwitchInputs() {
}
engine->engineState.clutchUpState = getClutchUpState();
#if EFI_IDLE_CONTROL
if (isBrainPinValid(engineConfiguration->throttlePedalUpPin)) {
engine->module<IdleController>().unmock().throttlePedalUpState = efiReadPin(engineConfiguration->throttlePedalUpPin);
}
#endif // EFI_IDLE_CONTROL
engine->engineState.brakePedalState = getBrakePedalState();
@ -288,7 +290,9 @@ void Engine::resetLua() {
#endif // EFI_BOOST_CONTROL
ignitionState.luaTimingAdd = 0;
ignitionState.luaTimingMult = 1;
#if EFI_IDLE_CONTROL
module<IdleController>().unmock().luaAdd = 0;
#endif // EFI_IDLE_CONTROL
}
/**

View File

@ -742,10 +742,12 @@ void configureRusefiLuaHooks(lua_State* l) {
return 0;
});
#endif // EFI_BOOST_CONTROL
#if EFI_IDLE_CONTROL
lua_register(l, "setIdleAdd", [](lua_State* l) {
engine->module<IdleController>().unmock().luaAdd = luaL_checknumber(l, 1);
return 0;
});
#endif
lua_register(l, "setTimingAdd", [](lua_State* l) {
engine->ignitionState.luaTimingAdd = luaL_checknumber(l, 1);
return 0;