Lua A/C Input #4333
This commit is contained in:
parent
e45990462c
commit
67ec949eb6
|
@ -311,11 +311,16 @@ void Engine::updateSwitchInputs() {
|
|||
if (isBrainPinValid(engineConfiguration->clutchDownPin)) {
|
||||
engine->engineState.clutchDownState = engineConfiguration->clutchDownPinInverted ^ efiReadPin(engineConfiguration->clutchDownPin);
|
||||
}
|
||||
if (hasAcToggle()) {
|
||||
bool result = getAcToggle();
|
||||
{
|
||||
bool currentState;
|
||||
if (hasAcToggle()) {
|
||||
currentState = getAcToggle();
|
||||
} else {
|
||||
currentState = engine->engineState.lua.acRequestState;
|
||||
}
|
||||
AcController & acController = engine->module<AcController>().unmock();
|
||||
if (acController.acButtonState != result) {
|
||||
acController.acButtonState = result;
|
||||
if (acController.acButtonState != currentState) {
|
||||
acController.acButtonState = currentState;
|
||||
acController.acSwitchLastChangeTimeMs = US2MS(getTimeNowUs());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -558,6 +558,11 @@ void configureRusefiLuaHooks(lua_State* l) {
|
|||
return 0;
|
||||
});
|
||||
|
||||
lua_register(l, "setAcRequestState", [](lua_State* l) {
|
||||
engine->engineState.lua.acRequestState = lua_toboolean(l, 1);
|
||||
return 0;
|
||||
});
|
||||
|
||||
lua_register(l, "getCalibration", [](lua_State* l) {
|
||||
auto propertyName = luaL_checklstring(l, 1, nullptr);
|
||||
auto result = getConfigValueByName(propertyName);
|
||||
|
|
|
@ -21,5 +21,5 @@ bool getAcToggle() {
|
|||
}
|
||||
|
||||
bool hasAcToggle() {
|
||||
return (isBrainPinValid(engineConfiguration->acSwitch));
|
||||
return isBrainPinValid(engineConfiguration->acSwitch);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue