bench test has no need for pin AND pin (#5490)

* bench test has no need for pin AND pin

* bench test has no need for pin AND pin

---------

Co-authored-by: Matthew Kennedy <matthewkennedy@outlook.com>
This commit is contained in:
rusefillc 2023-08-05 13:35:12 -04:00 committed by GitHub
parent f3a5586e36
commit 1d6410c420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 23 deletions

View File

@ -79,7 +79,7 @@ static void benchOff(OutputPin* output) {
output->setValue(BENCH_MSG, false); output->setValue(BENCH_MSG, false);
} }
static void runBench(brain_pin_e brainPin, OutputPin *output, float startDelayMs, float onTimeMs, float offTimeMs, static void runBench(OutputPin *output, float startDelayMs, float onTimeMs, float offTimeMs,
int count) { int count) {
int startDelayUs = MS2US(maxF(0.1, startDelayMs)); int startDelayUs = MS2US(maxF(0.1, startDelayMs));
int onTimeUs = MS2US(maxF(0.1, onTimeMs)); int onTimeUs = MS2US(maxF(0.1, onTimeMs));
@ -91,7 +91,7 @@ static void runBench(brain_pin_e brainPin, OutputPin *output, float startDelayMs
} }
efiPrintf("Running bench: ON_TIME=%d us OFF_TIME=%d us Counter=%d", onTimeUs, offTimeUs, count); efiPrintf("Running bench: ON_TIME=%d us OFF_TIME=%d us Counter=%d", onTimeUs, offTimeUs, count);
efiPrintf("output on %s", hwPortname(brainPin)); efiPrintf("output on %s", hwPortname(output->brainPin));
chThdSleepMicroseconds(startDelayUs); chThdSleepMicroseconds(startDelayUs);
@ -124,20 +124,18 @@ static float onTimeMs;
static float offTimeMs; static float offTimeMs;
static float startDelayMs; static float startDelayMs;
static int count; static int count;
static brain_pin_e brainPin;
static OutputPin* pinX; static OutputPin* pinX;
static chibios_rt::CounterSemaphore benchSemaphore(0); static chibios_rt::CounterSemaphore benchSemaphore(0);
static void pinbench(float startdelay, float p_ontimeMs, float p_offtimeMs, int iterations, static void pinbench(float startdelay, float p_ontimeMs, float p_offtimeMs, int iterations,
OutputPin* pinParam, brain_pin_e brainPinParam) OutputPin* pinParam)
{ {
startDelayMs = startdelay; startDelayMs = startdelay;
onTimeMs = p_ontimeMs; onTimeMs = p_ontimeMs;
offTimeMs = p_offtimeMs; offTimeMs = p_offtimeMs;
count = iterations; count = iterations;
pinX = pinParam; pinX = pinParam;
brainPin = brainPinParam;
// let's signal bench thread to wake up // let's signal bench thread to wake up
isBenchTestPending = true; isBenchTestPending = true;
benchSemaphore.signal(); benchSemaphore.signal();
@ -151,7 +149,7 @@ static void doRunFuelInjBench(size_t humanIndex, float delay, float onTimeMs, fl
return; return;
} }
pinbench(delay, onTimeMs, offTimeMs, count, pinbench(delay, onTimeMs, offTimeMs, count,
&enginePins.injectors[humanIndex - 1], engineConfiguration->injectionPins[humanIndex - 1]); &enginePins.injectors[humanIndex - 1]);
} }
static void doRunSparkBench(size_t humanIndex, float delay, float onTime, float offTime, int count) { static void doRunSparkBench(size_t humanIndex, float delay, float onTime, float offTime, int count) {
@ -159,8 +157,7 @@ static void doRunSparkBench(size_t humanIndex, float delay, float onTime, float
efiPrintf("Invalid index: %d", humanIndex); efiPrintf("Invalid index: %d", humanIndex);
return; return;
} }
pinbench(delay, onTime, offTime, count, pinbench(delay, onTime, offTime, count, &enginePins.coils[humanIndex - 1]);
&enginePins.coils[humanIndex - 1], engineConfiguration->ignitionPins[humanIndex - 1]);
} }
static void doRunSolenoidBench(size_t humanIndex, float delay, float onTime, float offTime, int count) { static void doRunSolenoidBench(size_t humanIndex, float delay, float onTime, float offTime, int count) {
@ -168,8 +165,7 @@ static void doRunSolenoidBench(size_t humanIndex, float delay, float onTime, flo
efiPrintf("Invalid index: %d", humanIndex); efiPrintf("Invalid index: %d", humanIndex);
return; return;
} }
pinbench(delay, onTime, offTime, count, pinbench(delay, onTime, offTime, count, &enginePins.tcuSolenoids[humanIndex - 1]);
&enginePins.tcuSolenoids[humanIndex - 1], engineConfiguration->tcu_solenoid[humanIndex - 1]);
} }
static void doRunBenchTestLuaOutput(size_t humanIndex, float delay, float onTimeMs, float offTimeMs, int count) { static void doRunBenchTestLuaOutput(size_t humanIndex, float delay, float onTimeMs, float offTimeMs, int count) {
@ -178,7 +174,7 @@ static void doRunBenchTestLuaOutput(size_t humanIndex, float delay, float onTime
return; return;
} }
pinbench(delay, onTimeMs, offTimeMs, count, pinbench(delay, onTimeMs, offTimeMs, count,
&enginePins.luaOutputPins[humanIndex - 1], engineConfiguration->luaOutputPins[humanIndex - 1]); &enginePins.luaOutputPins[humanIndex - 1]);
} }
/** /**
@ -229,7 +225,7 @@ static void luaOutBench2(float delay, float humanIndex, float onTime, float offT
static void fanBenchExt(float onTimeMs) { static void fanBenchExt(float onTimeMs) {
pinbench(0.0, onTimeMs, 100.0, 1.0, pinbench(0.0, onTimeMs, 100.0, 1.0,
&enginePins.fanRelay, engineConfiguration->fanPin); &enginePins.fanRelay);
} }
void fanBench(void) { void fanBench(void) {
@ -237,31 +233,27 @@ void fanBench(void) {
} }
void fan2Bench(void) { void fan2Bench(void) {
pinbench(0.0, 3000.0, 100.0, 1.0, pinbench(0.0, 3000.0, 100.0, 1.0, &enginePins.fanRelay2);
&enginePins.fanRelay2, engineConfiguration->fan2Pin);
} }
/** /**
* we are blinking for 16 seconds so that one can click the button and walk around to see the light blinking * we are blinking for 16 seconds so that one can click the button and walk around to see the light blinking
*/ */
void milBench(void) { void milBench(void) {
pinbench(0.0, 500.0, 500.0, 16, pinbench(0.0, 500.0, 500.0, 16, &enginePins.checkEnginePin);
&enginePins.checkEnginePin, engineConfiguration->malfunctionIndicatorPin);
} }
void starterRelayBench(void) { void starterRelayBench(void) {
pinbench(0.0, 6000.0, 100.0, 1, pinbench(0.0, 6000.0, 100.0, 1, &enginePins.starterControl);
&enginePins.starterControl, engineConfiguration->starterControlPin);
} }
static void fuelPumpBenchExt(float durationMs) { static void fuelPumpBenchExt(float durationMs) {
pinbench(/*startdelay*/0, durationMs, 100.0, 1.0, pinbench(/*startdelay*/0, durationMs, 100.0, 1.0,
&enginePins.fuelPumpRelay, engineConfiguration->fuelPumpPin); &enginePins.fuelPumpRelay);
} }
void acRelayBench(void) { void acRelayBench(void) {
pinbench(/*startdelay*/0, 1000.0, 100.0, 1, pinbench(/*startdelay*/0, 1000.0, 100.0, 1, &enginePins.acRelay);
&enginePins.acRelay, engineConfiguration->acRelayPin);
} }
static void mainRelayBench(void) { static void mainRelayBench(void) {
@ -271,7 +263,7 @@ static void mainRelayBench(void) {
static void hpfpValveBench(void) { static void hpfpValveBench(void) {
pinbench(/*startdelay*/0, engineConfiguration->benchTestOnTime, engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount, pinbench(/*startdelay*/0, engineConfiguration->benchTestOnTime, engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount,
&enginePins.hpfpValve, engineConfiguration->hpfpValvePin); &enginePins.hpfpValve);
} }
void fuelPumpBench(void) { void fuelPumpBench(void) {
@ -290,7 +282,7 @@ private:
if (isBenchTestPending) { if (isBenchTestPending) {
isBenchTestPending = false; isBenchTestPending = false;
runBench(brainPin, pinX, startDelayMs, onTimeMs, offTimeMs, count); runBench(pinX, startDelayMs, onTimeMs, offTimeMs, count);
} }
if (widebandUpdatePending) { if (widebandUpdatePending) {