Something something Automatic Compression Release #3442
This commit is contained in:
parent
0813266ee1
commit
377c9e2fda
|
@ -798,6 +798,9 @@ void setHellenDefaultVrThresholds(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set engine_type 6
|
||||||
|
*/
|
||||||
void proteusHarley(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
void proteusHarley(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
strcpy(engineConfiguration->scriptSettingName[0], "compReleaseRpm");
|
strcpy(engineConfiguration->scriptSettingName[0], "compReleaseRpm");
|
||||||
engineConfiguration->scriptSetting[0] = 300;
|
engineConfiguration->scriptSetting[0] = 300;
|
||||||
|
@ -808,7 +811,12 @@ void proteusHarley(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->luaOutputPins[0] = PROTEUS_LS_12;
|
engineConfiguration->luaOutputPins[0] = PROTEUS_LS_12;
|
||||||
#if HW_PROTEUS
|
#if HW_PROTEUS
|
||||||
strncpy(config->luaScript, R"(
|
strncpy(config->luaScript, R"(
|
||||||
startPwm(0, 100, 0)
|
outputIndex = 0
|
||||||
|
startPwm(outputIndex, 100, 0)
|
||||||
|
|
||||||
|
rpmLimitSetting = findSetting("compReleaseRpm", 300)
|
||||||
|
compReleaseDulationLimit = findSetting("compReleaseDur", 6000)
|
||||||
|
|
||||||
function onTick()
|
function onTick()
|
||||||
rpm = getSensor("RPM")
|
rpm = getSensor("RPM")
|
||||||
-- handle nil RPM, todo: change firmware to avoid nil RPM
|
-- handle nil RPM, todo: change firmware to avoid nil RPM
|
||||||
|
@ -816,8 +824,10 @@ function onTick()
|
||||||
print('Rpm ' .. rpm)
|
print('Rpm ' .. rpm)
|
||||||
print('getTimeSinceTriggerEventMs ' .. getTimeSinceTriggerEventMs())
|
print('getTimeSinceTriggerEventMs ' .. getTimeSinceTriggerEventMs())
|
||||||
|
|
||||||
enableCompressionReleaseSolenoid = getTimeSinceTriggerEventMs() < 5000 and rpm < 300
|
enableCompressionReleaseSolenoid = getTimeSinceTriggerEventMs() < compReleaseDulationLimit and rpm < rpmLimitSetting
|
||||||
setPwmDuty(0, enableCompressionReleaseSolenoid and 100 or 0)
|
duty = enableCompressionReleaseSolenoid and 100 or 0
|
||||||
|
print("Compression release solenoid " .. duty)
|
||||||
|
setPwmDuty(outputIndex, duty)
|
||||||
end
|
end
|
||||||
)", efi::size(config->luaScript));
|
)", efi::size(config->luaScript));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -497,9 +497,11 @@ void configureRusefiLuaHooks(lua_State* l) {
|
||||||
EXPAND_Engine;
|
EXPAND_Engine;
|
||||||
#endif
|
#endif
|
||||||
auto name = luaL_checklstring(l, 1, nullptr);
|
auto name = luaL_checklstring(l, 1, nullptr);
|
||||||
|
auto defaultValue = luaL_checknumber(l, 2);
|
||||||
|
|
||||||
auto index = getSettingIndexByName(name PASS_ENGINE_PARAMETER_SUFFIX);
|
auto index = getSettingIndexByName(name PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
if (index == EFI_ERROR_CODE) {
|
if (index == EFI_ERROR_CODE) {
|
||||||
lua_pushnil(l);
|
lua_pushnumber(l, defaultValue);
|
||||||
} else {
|
} else {
|
||||||
// TS counts curve from 1 so convert indexing here
|
// TS counts curve from 1 so convert indexing here
|
||||||
lua_pushnumber(l, engineConfiguration->scriptSetting[index]);
|
lua_pushnumber(l, engineConfiguration->scriptSetting[index]);
|
||||||
|
|
Loading…
Reference in New Issue