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