lua outputs bench test

This commit is contained in:
rusefi 2022-08-24 13:20:14 -04:00
parent 37d1073336
commit eb976de07d
3 changed files with 8 additions and 8 deletions

View File

@ -169,14 +169,13 @@ static void doRunSolenoidBench(size_t humanIndex, float delay, float onTime, flo
&enginePins.tcuSolenoids[humanIndex - 1], engineConfiguration->tcu_solenoid[humanIndex - 1]);
}
static void doRunBenchTestLuaOutput(size_t humanIndex, float /* delay */, float /* onTime */, float /* offTime */, int /* count */) {
static void doRunBenchTestLuaOutput(size_t humanIndex, float delay, float onTime, float offTime, int count) {
if (humanIndex < 1 || humanIndex > LUA_PWM_COUNT) {
efiPrintf("Invalid index: %d", humanIndex);
return;
}
// todo: convert in lua bench test
// pinbench(delay, onTime, offTime, count,
// &enginePins.luaOutputPins[humanIndex - 1], engineConfiguration->luaOutputPins[humanIndex - 1]);
pinbench(delay, onTime, offTime, count,
&enginePins.luaOutputPins[humanIndex - 1], engineConfiguration->luaOutputPins[humanIndex - 1]);
}
/**

View File

@ -208,7 +208,6 @@ AirmassModelBase& getLuaAirmassModel() {
#if !EFI_UNIT_TEST
static SimplePwm pwms[LUA_PWM_COUNT];
static OutputPin pins[LUA_PWM_COUNT];
struct P {
SimplePwm& pwm;
@ -237,7 +236,7 @@ static int lua_startPwm(lua_State* l) {
startSimplePwmExt(
&p.pwm, "lua", &engine->executor,
engineConfiguration->luaOutputPins[p.idx], &pins[p.idx],
engineConfiguration->luaOutputPins[p.idx], &enginePins.luaOutputPins[p.idx],
freq, duty
);
@ -246,8 +245,8 @@ static int lua_startPwm(lua_State* l) {
void luaDeInitPins() {
// Simply de-init all pins - when the script runs again, they will be re-init'd
for (size_t i = 0; i < efi::size(pins); i++) {
pins[i].deInit();
for (size_t i = 0; i < efi::size(enginePins.luaOutputPins); i++) {
enginePins.luaOutputPins[i].deInit();
}
}

View File

@ -186,6 +186,8 @@ public:
RegisteredOutputPin acRelay;
RegisteredOutputPin fuelPumpRelay;
OutputPin o2heater;
OutputPin luaOutputPins[LUA_PWM_COUNT];
/**
* brain board RED LED by default
*/