maybe lua freezes proteus h7 after 7 seconds of run #3539

This commit is contained in:
rusefi 2021-11-12 13:45:07 -05:00
parent b2c2e7e0c1
commit b3204da186
1 changed files with 22 additions and 12 deletions

View File

@ -874,10 +874,31 @@ void proteusLuaDemo(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// ETB disable PD11
engineConfiguration->etbIo[0].disablePin = GPIO_UNASSIGNED;
auto script = R"(
/**
controlIndex = 0
directionIndex = 1
print('pid output ' .. output)
print('')
local duty = (bias + output) / 100
-- isPositive = duty > 0;
-- pwmValue = isPositive and duty or -duty
-- setPwmDuty(controlIndex, pwmValue)
-- dirValue = isPositive and 1 or 0;
-- setPwmDuty(directionIndex, dirValue)
-- print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
*
*/
auto script = R"(
startPwm(0, 800, 0.1)
-- direction
startPwm(1, 80, 1.0)
@ -914,17 +935,6 @@ function onTick()
print('pid output ' .. output)
print('')
local duty = (bias + output) / 100
-- isPositive = duty > 0;
-- pwmValue = isPositive and duty or -duty
-- setPwmDuty(controlIndex, pwmValue)
-- dirValue = isPositive and 1 or 0;
-- setPwmDuty(directionIndex, dirValue)
-- print('pwm ' .. pwmValue .. ' dir ' .. dirValue)
end
)";
strncpy(config->luaScript, script, efi::size(config->luaScript));