parent
ef9574bd3a
commit
fcf04e6730
|
@ -32,6 +32,7 @@
|
|||
int minCrankingRpm = 0;
|
||||
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcTimingDropTable;
|
||||
static Map3D<TRACTION_CONTROL_ETB_DROP_SIZE, TRACTION_CONTROL_ETB_DROP_SIZE, int8_t, uint16_t, uint8_t> tcSparkSkipTable;
|
||||
|
||||
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
|
||||
|
||||
|
@ -60,6 +61,8 @@ static angle_t getRunningAdvance(int rpm, float engineLoad) {
|
|||
float vehicleSpeed = Sensor::getOrZero(SensorType::VehicleSpeed);
|
||||
float wheelSlip = Sensor::getOrZero(SensorType::WheelSlipRatio);
|
||||
engine->ignitionState.tractionAdvanceDrop = tcTimingDropTable.getValue(wheelSlip, vehicleSpeed);
|
||||
engine->engineState.tractionControlSparkSkip = tcSparkSkipTable.getValue(wheelSlip, vehicleSpeed);
|
||||
engine->engineState.updateSparkSkip();
|
||||
|
||||
advanceAngle += engine->ignitionState.tractionAdvanceDrop;
|
||||
|
||||
|
@ -253,6 +256,7 @@ size_t getMultiSparkCount(int rpm) {
|
|||
|
||||
void initIgnitionAdvanceControl() {
|
||||
tcTimingDropTable.initTable(engineConfiguration->tractionControlTimingDrop, engineConfiguration->tractionControlSlipBins, engineConfiguration->tractionControlSpeedBins);
|
||||
tcSparkSkipTable.initTable(engineConfiguration->tractionControlIgnitionSkip, engineConfiguration->tractionControlSlipBins, engineConfiguration->tractionControlSpeedBins);
|
||||
}
|
||||
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
|
|
|
@ -88,6 +88,11 @@ EngineState::EngineState() {
|
|||
void EngineState::updateSlowSensors() {
|
||||
}
|
||||
|
||||
void EngineState::updateSparkSkip() {
|
||||
engine->softSparkLimiter.setTargetSkipRatio(luaSoftSparkSkip + engineConfiguration->useHardSkipInTraction ? 0 : tractionControlSparkSkip);
|
||||
engine->hardSparkLimiter.setTargetSkipRatio(luaHardSparkSkip + engineConfiguration->useHardSkipInTraction ? tractionControlSparkSkip : 0);
|
||||
}
|
||||
|
||||
void EngineState::periodicFastCallback() {
|
||||
ScopePerf perf(PE::EngineStatePeriodicFastCallback);
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ public:
|
|||
void updateSlowSensors();
|
||||
void updateTChargeK(int rpm, float tps);
|
||||
|
||||
void updateSparkSkip();
|
||||
|
||||
/**
|
||||
* always 360 or 720, never zero
|
||||
*/
|
||||
|
|
|
@ -823,12 +823,14 @@ void configureRusefiLuaHooks(lua_State* lState) {
|
|||
#if EFI_LAUNCH_CONTROL
|
||||
lua_register(lState, "setSparkSkipRatio", [](lua_State* l) {
|
||||
auto targetSkipRatio = luaL_checknumber(l, 1);
|
||||
engine->softSparkLimiter.setTargetSkipRatio(targetSkipRatio);
|
||||
engine->engineState.luaSoftSparkSkip = targetSkipRatio;
|
||||
engine->engineState.updateSparkSkip();
|
||||
return 1;
|
||||
});
|
||||
lua_register(lState, "setSparkHardSkipRatio", [](lua_State* l) {
|
||||
auto targetSkipRatio = luaL_checknumber(l, 1);
|
||||
engine->hardSparkLimiter.setTargetSkipRatio(targetSkipRatio);
|
||||
engine->engineState.luaHardSparkSkip = targetSkipRatio;
|
||||
engine->engineState.updateSparkSkip();
|
||||
return 1;
|
||||
});
|
||||
#endif // EFI_LAUNCH_CONTROL
|
||||
|
|
Loading…
Reference in New Issue