mirror of https://github.com/rusefi/rusefi-1.git
Air Conditioning Improvements #4054
This commit is contained in:
parent
49d6e5efb7
commit
ed6ed0d93e
|
@ -45,6 +45,9 @@ bool AcController::getAcState() {
|
||||||
if (tpsTooHigh) {
|
if (tpsTooHigh) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (isDisabledByLua) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
acButtonState = engine->acSwitchState;
|
acButtonState = engine->acSwitchState;
|
||||||
// All conditions allow AC, simply pass thru switch
|
// All conditions allow AC, simply pass thru switch
|
||||||
|
|
|
@ -7,8 +7,9 @@ bit engineTooHot
|
||||||
bit tpsTooHigh
|
bit tpsTooHigh
|
||||||
|
|
||||||
bit acButtonState
|
bit acButtonState
|
||||||
bit isDisabledByLua
|
bit isDisabledByLua;For setAcDisabled Lua method
|
||||||
|
|
||||||
int latest_usage_ac_control;
|
int latest_usage_ac_control;
|
||||||
|
int acSwitchLastChangeTimeMs;
|
||||||
|
|
||||||
end_struct
|
end_struct
|
||||||
|
|
|
@ -292,6 +292,17 @@ struct LuaThread : ThreadController<4096> {
|
||||||
void ThreadTask() override;
|
void ThreadTask() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void resetLua() {
|
||||||
|
engine->module<AcController>().unmock().isDisabledByLua = false;
|
||||||
|
#if EFI_CAN_SUPPORT
|
||||||
|
resetLuaCanRx();
|
||||||
|
#endif // EFI_CAN_SUPPORT
|
||||||
|
|
||||||
|
// De-init pins, they will reinit next start of the script.
|
||||||
|
luaDeInitPins();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool needsReset = false;
|
static bool needsReset = false;
|
||||||
|
|
||||||
// Each invocation of runOneLua will:
|
// Each invocation of runOneLua will:
|
||||||
|
@ -335,12 +346,7 @@ static bool runOneLua(lua_Alloc alloc, const char* script) {
|
||||||
engine->outputChannels.luaInvocationCounter++;
|
engine->outputChannels.luaInvocationCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_CAN_SUPPORT
|
resetLua();
|
||||||
resetLuaCanRx();
|
|
||||||
#endif // EFI_CAN_SUPPORT
|
|
||||||
|
|
||||||
// De-init pins, they will reinit next start of the script.
|
|
||||||
luaDeInitPins();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -588,6 +588,12 @@ void configureRusefiLuaHooks(lua_State* l) {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lua_register(l, "setAcDisabled", [](lua_State* l) {
|
||||||
|
auto value = lua_toboolean(l, 1);
|
||||||
|
engine->module<AcController>().unmock().isDisabledByLua = value;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
lua_register(l, "setTimingAdd", [](lua_State* l) {
|
lua_register(l, "setTimingAdd", [](lua_State* l) {
|
||||||
engine->engineState.luaAdjustments.ignitionTimingAdd = luaL_checknumber(l, 1);
|
engine->engineState.luaAdjustments.ignitionTimingAdd = luaL_checknumber(l, 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue