Detail on how to set up iDrive or equivalent CAN button control #226
boost lua
This commit is contained in:
parent
f7ac901380
commit
39df02fe35
|
@ -28,6 +28,12 @@ void BoostController::init(IPwm* pwm, const ValueProvider3D* openLoopMap, const
|
|||
m_closedLoopTargetMap = closedLoopTargetMap;
|
||||
|
||||
m_pid.initPidClass(pidParams);
|
||||
resetLua();
|
||||
}
|
||||
|
||||
void BoostController::resetLua() {
|
||||
luaTargetAdd = 0;
|
||||
luaTargetMult = 1;
|
||||
}
|
||||
|
||||
void BoostController::onConfigurationChange(pid_s* previousConfiguration) {
|
||||
|
@ -60,7 +66,7 @@ expected<float> BoostController::getSetpoint() {
|
|||
|
||||
efiAssert(OBD_PCM_Processor_Fault, m_closedLoopTargetMap != nullptr, "boost closed loop target", unexpected);
|
||||
|
||||
return m_closedLoopTargetMap->getValue(rpm, tps.Value);
|
||||
return m_closedLoopTargetMap->getValue(rpm, tps.Value) * luaTargetMult + luaTargetAdd;
|
||||
}
|
||||
|
||||
expected<percent_t> BoostController::getOpenLoop(float target) {
|
||||
|
|
|
@ -17,6 +17,7 @@ class BoostController : public boost_control_s, public ClosedLoopController<floa
|
|||
public:
|
||||
void init(IPwm* pmw, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams);
|
||||
void update();
|
||||
void resetLua();
|
||||
|
||||
// Called when the configuration may have changed. Controller will
|
||||
// reset if necessary.
|
||||
|
|
|
@ -360,8 +360,7 @@ void Engine::resetLua() {
|
|||
// todo: https://github.com/rusefi/rusefi/issues/4308
|
||||
engineState.lua = {};
|
||||
engineState.lua.fuelMult = 1;
|
||||
boostController.luaTargetAdd = 0;
|
||||
boostController.luaTargetMult = 1;
|
||||
boostController.resetLua();
|
||||
ignitionState.luaTimingAdd = 0;
|
||||
ignitionState.luaTimingMult = 1;
|
||||
}
|
||||
|
|
|
@ -522,7 +522,18 @@ void configureRusefiLuaHooks(lua_State* l) {
|
|||
return 1;
|
||||
});
|
||||
|
||||
|
||||
lua_register(l, "setBoostAdd", [](lua_State* l) {
|
||||
engine->boostController.luaTargetAdd = luaL_checknumber(l, 1);
|
||||
return 0;
|
||||
});
|
||||
lua_register(l, "setBoostMult", [](lua_State* l) {
|
||||
engine->boostController.luaTargetMult = luaL_checknumber(l, 1);
|
||||
return 0;
|
||||
});
|
||||
lua_register(l, "setTimingAdd", [](lua_State* l) {
|
||||
engine->ignitionState.luaTimingAdd = luaL_checknumber(l, 1);
|
||||
return 0;
|
||||
});
|
||||
lua_register(l, "setTimingMult", [](lua_State* l) {
|
||||
engine->ignitionState.luaTimingMult = luaL_checknumber(l, 1);
|
||||
return 0;
|
||||
|
@ -613,11 +624,6 @@ void configureRusefiLuaHooks(lua_State* l) {
|
|||
return 1;
|
||||
});
|
||||
|
||||
lua_register(l, "setTimingAdd", [](lua_State* l) {
|
||||
engine->ignitionState.luaTimingAdd = luaL_checknumber(l, 1);
|
||||
return 0;
|
||||
});
|
||||
|
||||
#if EFI_VEHICLE_SPEED
|
||||
lua_register(l, "getCurrentGear", [](lua_State* l) {
|
||||
lua_pushinteger(l, engine->module<GearDetector>()->getCurrentGear());
|
||||
|
|
Loading…
Reference in New Issue