pid demo progress
This commit is contained in:
parent
e089b8d9ac
commit
8aaecb568e
|
@ -626,27 +626,26 @@ void mreSecondaryCan(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
// engineConfiguration->afr.hwChannel = EFI_ADC_14;
|
||||
|
||||
|
||||
strncpy(config->luaScript, "function onTick()\n"
|
||||
"txPayload = {}\n"
|
||||
"function onTick()\n"
|
||||
" auxV = getAuxAnalog(0)\n"
|
||||
" print('Hello analog ' .. auxV )\n"
|
||||
" -- first byte: integer part, would be autoboxed to int\n"
|
||||
" txPayload[1] = auxV\n"
|
||||
" -- second byte: fractional part, would be autoboxed to int, overflow would be ignored\n"
|
||||
" txPayload[2] = auxV * 256;\n"
|
||||
" auxV = getAuxAnalog(1)\n"
|
||||
" print('Hello analog ' .. auxV )\n"
|
||||
" txPayload[3] = auxV\n"
|
||||
" txPayload[4] = auxV * 256;\n"
|
||||
" auxV = getAuxAnalog(2)\n"
|
||||
" print('Hello analog ' .. auxV )\n"
|
||||
" txPayload[5] = auxV\n"
|
||||
" txPayload[6] = auxV * 256;\n"
|
||||
" txCan(1, 0x600, 1, txPayload)\n"
|
||||
"end"
|
||||
|
||||
"end", efi::size(config->luaScript));
|
||||
strncpy(config->luaScript, R"(
|
||||
txPayload = {}
|
||||
function onTick()
|
||||
auxV = getAuxAnalog(0)
|
||||
print('Hello analog ' .. auxV )
|
||||
-- first byte: integer part, would be autoboxed to int
|
||||
txPayload[1] = auxV
|
||||
-- second byte: fractional part, would be autoboxed to int, overflow would be ignored
|
||||
txPayload[2] = auxV * 256;
|
||||
auxV = getAuxAnalog(1)
|
||||
print('Hello analog ' .. auxV )
|
||||
txPayload[3] = auxV
|
||||
txPayload[4] = auxV * 256;
|
||||
auxV = getAuxAnalog(2)
|
||||
print('Hello analog ' .. auxV )
|
||||
txPayload[5] = auxV
|
||||
txPayload[6] = auxV * 256;
|
||||
txCan(1, 0x600, 1, txPayload)
|
||||
end
|
||||
)", efi::size(config->luaScript));
|
||||
|
||||
}
|
||||
|
||||
|
@ -830,6 +829,45 @@ void setHellenDefaultVrThresholds(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
}
|
||||
|
||||
void proteusLuaDemo(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
#if HW_PROTEUS
|
||||
engineConfiguration->tpsMin = 889;
|
||||
engineConfiguration->tpsMax = 67;
|
||||
|
||||
engineConfiguration->tps1SecondaryMin = 105;
|
||||
engineConfiguration->tps1SecondaryMax = 933;
|
||||
|
||||
strcpy(engineConfiguration->scriptCurveName[3 - 1], "bias");
|
||||
|
||||
/**
|
||||
* for this demo I use ETB just a sample object to control with PID. No reasonable person should consider actually using
|
||||
* Lua for actual intake ETB control while driving around the racing track - hard-coded ETB control is way smarter!
|
||||
*/
|
||||
static const float defaultBiasBins[] = {
|
||||
0, 1, 2, 4, 7, 98, 99, 100
|
||||
};
|
||||
static const float defaultBiasValues[] = {
|
||||
-20, -18, -17, 0, 20, 21, 22, 25
|
||||
};
|
||||
|
||||
engineConfiguration->luaOutputPins[0] = GPIOD_12;
|
||||
|
||||
copyArray(CONFIG(scriptCurve3Bins), defaultBiasBins);
|
||||
copyArray(CONFIG(scriptCurve3), defaultBiasValues);
|
||||
|
||||
|
||||
// ETB direction #1 PD10
|
||||
// ETB control PD12
|
||||
// ETB disable PD11
|
||||
|
||||
auto script = R"(
|
||||
function testFunc()
|
||||
return 5.5
|
||||
end
|
||||
)";
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HW_HELLEN
|
||||
void setHellen144LedPins(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
#ifdef EFI_COMMUNICATION_PIN
|
||||
|
|
|
@ -29,6 +29,7 @@ void mreBCM(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
|||
* set engine_type 42
|
||||
*/
|
||||
void proteusBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
void proteusLuaDemo(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
void setTest33816EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
void setBoschHDEV_5_injectors(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -940,6 +940,9 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e
|
|||
case PROTEUS_QC_TEST_BOARD:
|
||||
proteusBoardTest(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case PROTEUS_LUA_DEMO:
|
||||
proteusLuaDemo(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
case PROTEUS_BMW_M73:
|
||||
setEngineBMW_M73_Proteus(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue