Uniform reset pattern for all Lua adjustments #4308
no progress only preparation
This commit is contained in:
parent
8fa41f36f0
commit
82131e5572
|
@ -19,6 +19,7 @@ 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);
|
||||
|
|
|
@ -79,6 +79,8 @@ float FuelConsumptionState::getConsumptionGramPerSecond() const {
|
|||
|
||||
EngineState::EngineState() {
|
||||
timeSinceLastTChargeK = getTimeNowNt();
|
||||
// todo: https://github.com/rusefi/rusefi/issues/4308
|
||||
lua.fuelMult = 1;
|
||||
}
|
||||
|
||||
void EngineState::updateSlowSensors() {
|
||||
|
|
|
@ -13,10 +13,6 @@
|
|||
#include "efi_pid.h"
|
||||
#include "engine_state_generated.h"
|
||||
|
||||
struct LuaAdjustmentsLegacy {
|
||||
float fuelMult = 1;
|
||||
};
|
||||
|
||||
class EngineState : public engine_state_s {
|
||||
public:
|
||||
EngineState();
|
||||
|
@ -75,6 +71,4 @@ public:
|
|||
|
||||
float targetLambda = 0.0f;
|
||||
float stoichiometricRatio = 0.0f;
|
||||
|
||||
LuaAdjustmentsLegacy luaAdjustments;
|
||||
};
|
||||
|
|
|
@ -310,7 +310,7 @@ void LuaThread::ThreadTask() {
|
|||
bool wasOk = runOneLua(myAlloc, config->luaScript);
|
||||
|
||||
// Reset any lua adjustments the script made
|
||||
engine->engineState.luaAdjustments = {};
|
||||
// todo https://github.com/rusefi/rusefi/issues/4308 engine->engineState.luaAdjustments = {};
|
||||
|
||||
if (!wasOk) {
|
||||
// Something went wrong executing the script, spin
|
||||
|
|
|
@ -534,7 +534,7 @@ void configureRusefiLuaHooks(lua_State* l) {
|
|||
return 0;
|
||||
});
|
||||
lua_register(l, "setFuelMult", [](lua_State* l) {
|
||||
engine->engineState.luaAdjustments.fuelMult = luaL_checknumber(l, 1);
|
||||
engine->engineState.lua.fuelMult = luaL_checknumber(l, 1);
|
||||
return 0;
|
||||
});
|
||||
#if EFI_PROD_CODE
|
||||
|
|
Loading…
Reference in New Issue