This commit is contained in:
rusefillc 2022-07-14 12:36:55 -04:00
parent 7cada13589
commit cad14d6541
5 changed files with 12 additions and 8 deletions

View File

@ -18,9 +18,5 @@ size_t getMultiSparkCount(int rpm);
class IgnitionState : public ignition_state_s {
public:
IgnitionState() {
// todo https://github.com/rusefi/rusefi/issues/4308
luaTimingMult = 1;
}
floatms_t getSparkDwell(int rpm);
};

View File

@ -353,8 +353,18 @@ void Engine::reset() {
*/
engineCycle = getEngineCycle(FOUR_STROKE_CRANK_SENSOR);
memset(&ignitionPin, 0, sizeof(ignitionPin));
resetLua();
}
void Engine::resetLua() {
// todo: https://github.com/rusefi/rusefi/issues/4308
engineState.lua = {};
engineState.lua.fuelMult = 1;
boostController.luaTargetAdd = 0;
boostController.luaTargetMult = 1;
ignitionState.luaTimingAdd = 0;
ignitionState.luaTimingMult = 1;
}
/**
* Here we have a bunch of stuff which should invoked after configuration change

View File

@ -219,11 +219,11 @@ public:
#endif // EFI_BOOST_CONTROL
IgnitionState ignitionState;
void resetLua();
FanControl1 fan1;
FanControl2 fan2;
efitick_t mostRecentSparkEvent;
efitick_t mostRecentTimeBetweenSparkEvents;
efitick_t mostRecentIgnitionEvent;

View File

@ -79,8 +79,6 @@ float FuelConsumptionState::getConsumptionGramPerSecond() const {
EngineState::EngineState() {
timeSinceLastTChargeK = getTimeNowNt();
// todo: https://github.com/rusefi/rusefi/issues/4308
lua.fuelMult = 1;
}
void EngineState::updateSlowSensors() {

View File

@ -319,7 +319,7 @@ void LuaThread::ThreadTask() {
bool wasOk = runOneLua(myAlloc, config->luaScript);
// Reset any lua adjustments the script made
// todo https://github.com/rusefi/rusefi/issues/4308 engine->engineState.luaAdjustments = {};
engine->resetLua();
if (!wasOk) {
// Something went wrong executing the script, spin