bench test delay parameter is not useful (#5491)
Co-authored-by: Matthew Kennedy <matthewkennedy@outlook.com>
This commit is contained in:
parent
45bafe99e6
commit
03a714055f
|
@ -135,7 +135,7 @@ typedef void (*VoidIntVoidPtr)(int, void*);
|
|||
typedef void (*VoidFloat)(float);
|
||||
typedef void (*VoidFloatFloat)(float, float);
|
||||
typedef void (*VoidFloatFloatFloat)(float, float, float);
|
||||
typedef void (*VoidFloatFloatFloatFloatFloat)(float, float, float, float, float);
|
||||
typedef void (*VoidFloatFloatFloatFloat)(float, float, float, float);
|
||||
typedef void (*VoidFloatFloatVoidPtr)(float, float, void*);
|
||||
typedef void (*VoidIntInt)(int, int);
|
||||
typedef void (*VoidIntIntVoidPtr)(int, int, void*);
|
||||
|
|
|
@ -78,9 +78,7 @@ static void benchOff(OutputPin* output) {
|
|||
output->setValue(BENCH_MSG, false);
|
||||
}
|
||||
|
||||
static void runBench(OutputPin *output, float startDelayMs, float onTimeMs, float offTimeMs,
|
||||
int count) {
|
||||
int startDelayUs = MS2US(maxF(0.1, startDelayMs));
|
||||
static void runBench(OutputPin *output, float onTimeMs, float offTimeMs, int count) {
|
||||
int onTimeUs = MS2US(maxF(0.1, onTimeMs));
|
||||
int offTimeUs = MS2US(maxF(0.1, offTimeMs));
|
||||
|
||||
|
@ -92,8 +90,6 @@ static void runBench(OutputPin *output, float startDelayMs, float onTimeMs, floa
|
|||
efiPrintf("Running bench: ON_TIME=%d us OFF_TIME=%d us Counter=%d", onTimeUs, offTimeUs, count);
|
||||
efiPrintf("output on %s", hwPortname(output->brainPin));
|
||||
|
||||
chThdSleepMicroseconds(startDelayUs);
|
||||
|
||||
isRunningBench = true;
|
||||
|
||||
for (int i = 0; isRunningBench && i < count; i++) {
|
||||
|
@ -121,16 +117,14 @@ static volatile bool isBenchTestPending = false;
|
|||
static bool widebandUpdatePending = false;
|
||||
static float onTimeMs;
|
||||
static float offTimeMs;
|
||||
static float startDelayMs;
|
||||
static int count;
|
||||
static OutputPin* pinX;
|
||||
|
||||
static chibios_rt::CounterSemaphore benchSemaphore(0);
|
||||
|
||||
static void pinbench(float startdelay, float p_ontimeMs, float p_offtimeMs, int iterations,
|
||||
static void pinbench(float p_ontimeMs, float p_offtimeMs, int iterations,
|
||||
OutputPin* pinParam)
|
||||
{
|
||||
startDelayMs = startdelay;
|
||||
onTimeMs = p_ontimeMs;
|
||||
offTimeMs = p_offtimeMs;
|
||||
count = iterations;
|
||||
|
@ -146,60 +140,60 @@ static void cancelBenchTest() {
|
|||
|
||||
/*==========================================================================*/
|
||||
|
||||
static void doRunFuelInjBench(size_t humanIndex, float delay, float onTimeMs, float offTimeMs, int count) {
|
||||
static void doRunFuelInjBench(size_t humanIndex, float onTimeMs, float offTimeMs, int count) {
|
||||
if (humanIndex < 1 || humanIndex > engineConfiguration->cylindersCount) {
|
||||
efiPrintf("Invalid index: %d", humanIndex);
|
||||
return;
|
||||
}
|
||||
pinbench(delay, onTimeMs, offTimeMs, count,
|
||||
pinbench(onTimeMs, offTimeMs, count,
|
||||
&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 onTime, float offTime, int count) {
|
||||
if (humanIndex < 1 || humanIndex > engineConfiguration->cylindersCount) {
|
||||
efiPrintf("Invalid index: %d", humanIndex);
|
||||
return;
|
||||
}
|
||||
pinbench(delay, onTime, offTime, count, &enginePins.coils[humanIndex - 1]);
|
||||
pinbench(onTime, offTime, count, &enginePins.coils[humanIndex - 1]);
|
||||
}
|
||||
|
||||
static void doRunSolenoidBench(size_t humanIndex, float delay, float onTime, float offTime, int count) {
|
||||
static void doRunSolenoidBench(size_t humanIndex, float onTime, float offTime, int count) {
|
||||
if (humanIndex < 1 || humanIndex > TCU_SOLENOID_COUNT) {
|
||||
efiPrintf("Invalid index: %d", humanIndex);
|
||||
return;
|
||||
}
|
||||
pinbench(delay, onTime, offTime, count, &enginePins.tcuSolenoids[humanIndex - 1]);
|
||||
pinbench(onTime, offTime, count, &enginePins.tcuSolenoids[humanIndex - 1]);
|
||||
}
|
||||
|
||||
static void doRunBenchTestLuaOutput(size_t humanIndex, float delay, float onTimeMs, float offTimeMs, int count) {
|
||||
static void doRunBenchTestLuaOutput(size_t humanIndex, float onTimeMs, float offTimeMs, int count) {
|
||||
if (humanIndex < 1 || humanIndex > LUA_PWM_COUNT) {
|
||||
efiPrintf("Invalid index: %d", humanIndex);
|
||||
return;
|
||||
}
|
||||
pinbench(delay, onTimeMs, offTimeMs, count,
|
||||
pinbench(onTimeMs, offTimeMs, count,
|
||||
&enginePins.luaOutputPins[humanIndex - 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* delay 100, cylinder #2, 5ms ON, 1000ms OFF, repeat 3 times
|
||||
* fuelInjBenchExt 100 2 5 1000 3
|
||||
* cylinder #2, 5ms ON, 1000ms OFF, repeat 3 times
|
||||
* fuelInjBenchExt 2 5 1000 3
|
||||
*/
|
||||
static void fuelInjBenchExt(float delay, float humanIndex, float onTimeMs, float offTimeMs, float count) {
|
||||
doRunFuelInjBench((int)humanIndex, delay, onTimeMs, offTimeMs, (int)count);
|
||||
static void fuelInjBenchExt(float humanIndex, float onTimeMs, float offTimeMs, float count) {
|
||||
doRunFuelInjBench((int)humanIndex, onTimeMs, offTimeMs, (int)count);
|
||||
}
|
||||
|
||||
/**
|
||||
* fuelbench 5 1000 2
|
||||
*/
|
||||
static void fuelInjBench(float onTimeMs, float offTimeMs, float count) {
|
||||
fuelInjBenchExt(0.0, 1, onTimeMs, offTimeMs, count);
|
||||
fuelInjBenchExt(1, onTimeMs, offTimeMs, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* sparkbench2 0 1 5 1000 2
|
||||
* sparkbench2 1 5 1000 2
|
||||
*/
|
||||
static void sparkBenchExt(float delay, float humanIndex, float onTime, float offTimeMs, float count) {
|
||||
doRunSparkBench((int)humanIndex, delay, onTime, offTimeMs, (int)count);
|
||||
static void sparkBenchExt(float humanIndex, float onTime, float offTimeMs, float count) {
|
||||
doRunSparkBench((int)humanIndex, onTime, offTimeMs, (int)count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,28 +201,27 @@ static void sparkBenchExt(float delay, float humanIndex, float onTime, float off
|
|||
* 5 ms ON, 400 ms OFF, two times
|
||||
*/
|
||||
static void sparkBench(float onTime, float offTimeMs, float count) {
|
||||
sparkBenchExt(0.0, 1, onTime, offTimeMs, count);
|
||||
sparkBenchExt(1, onTime, offTimeMs, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* delay 100, solenoid #2, 1000ms ON, 1000ms OFF, repeat 3 times
|
||||
* tcusolbench 100 2 1000 1000 3
|
||||
* solenoid #2, 1000ms ON, 1000ms OFF, repeat 3 times
|
||||
* tcusolbench 2 1000 1000 3
|
||||
*/
|
||||
static void tcuSolenoidBench(float delay, float humanIndex, float onTime, float offTimeMs, float count) {
|
||||
doRunSolenoidBench((int)humanIndex, delay, onTime, offTimeMs, (int)count);
|
||||
static void tcuSolenoidBench(float humanIndex, float onTime, float offTimeMs, float count) {
|
||||
doRunSolenoidBench((int)humanIndex, onTime, offTimeMs, (int)count);
|
||||
}
|
||||
|
||||
/**
|
||||
* delay 100, channel #1, 5ms ON, 1000ms OFF, repeat 3 times
|
||||
* fsiobench2 100 1 5 1000 3
|
||||
* channel #1, 5ms ON, 1000ms OFF, repeat 3 times
|
||||
* fsiobench2 1 5 1000 3
|
||||
*/
|
||||
static void luaOutBench2(float delay, float humanIndex, float onTime, float offTimeMs, float count) {
|
||||
doRunBenchTestLuaOutput((int)humanIndex, delay, onTime, offTimeMs, (int)count);
|
||||
static void luaOutBench2(float humanIndex, float onTime, float offTimeMs, float count) {
|
||||
doRunBenchTestLuaOutput((int)humanIndex, onTime, offTimeMs, (int)count);
|
||||
}
|
||||
|
||||
static void fanBenchExt(float onTimeMs) {
|
||||
pinbench(0.0, onTimeMs, 100.0, 1.0,
|
||||
&enginePins.fanRelay);
|
||||
pinbench(onTimeMs, 100.0, 1.0, &enginePins.fanRelay);
|
||||
}
|
||||
|
||||
void fanBench(void) {
|
||||
|
@ -236,27 +229,27 @@ void fanBench(void) {
|
|||
}
|
||||
|
||||
void fan2Bench(void) {
|
||||
pinbench(0.0, 3000.0, 100.0, 1.0, &enginePins.fanRelay2);
|
||||
pinbench(3000.0, 100.0, 1.0, &enginePins.fanRelay2);
|
||||
}
|
||||
|
||||
/**
|
||||
* we are blinking for 16 seconds so that one can click the button and walk around to see the light blinking
|
||||
*/
|
||||
void milBench(void) {
|
||||
pinbench(0.0, 500.0, 500.0, 16, &enginePins.checkEnginePin);
|
||||
pinbench(500.0, 500.0, 16, &enginePins.checkEnginePin);
|
||||
}
|
||||
|
||||
void starterRelayBench(void) {
|
||||
pinbench(0.0, 6000.0, 100.0, 1, &enginePins.starterControl);
|
||||
pinbench(6000.0, 100.0, 1, &enginePins.starterControl);
|
||||
}
|
||||
|
||||
static void fuelPumpBenchExt(float durationMs) {
|
||||
pinbench(/*startdelay*/0, durationMs, 100.0, 1.0,
|
||||
pinbench(durationMs, 100.0, 1.0,
|
||||
&enginePins.fuelPumpRelay);
|
||||
}
|
||||
|
||||
void acRelayBench(void) {
|
||||
pinbench(/*startdelay*/0, 1000.0, 100.0, 1, &enginePins.acRelay);
|
||||
pinbench(1000.0, 100.0, 1, &enginePins.acRelay);
|
||||
}
|
||||
|
||||
static void mainRelayBench(void) {
|
||||
|
@ -265,7 +258,7 @@ static void mainRelayBench(void) {
|
|||
}
|
||||
|
||||
static void hpfpValveBench(void) {
|
||||
pinbench(/*startdelay*/0, engineConfiguration->benchTestOnTime, engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount,
|
||||
pinbench(engineConfiguration->benchTestOnTime, engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount,
|
||||
&enginePins.hpfpValve);
|
||||
}
|
||||
|
||||
|
@ -285,7 +278,7 @@ private:
|
|||
|
||||
if (isBenchTestPending) {
|
||||
isBenchTestPending = false;
|
||||
runBench(pinX, startDelayMs, onTimeMs, offTimeMs, count);
|
||||
runBench(pinX, onTimeMs, offTimeMs, count);
|
||||
}
|
||||
|
||||
if (widebandUpdatePending) {
|
||||
|
@ -458,28 +451,28 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
|
|||
|
||||
case TS_IGNITION_CATEGORY:
|
||||
if (!running) {
|
||||
doRunSparkBench(index, 300.0, engineConfiguration->benchTestOnTime,
|
||||
doRunSparkBench(index, engineConfiguration->benchTestOnTime,
|
||||
engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount);
|
||||
}
|
||||
break;
|
||||
|
||||
case TS_INJECTOR_CATEGORY:
|
||||
if (!running) {
|
||||
doRunFuelInjBench(index, 300.0 , engineConfiguration->benchTestOnTime,
|
||||
doRunFuelInjBench(index, engineConfiguration->benchTestOnTime,
|
||||
engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount);
|
||||
}
|
||||
break;
|
||||
|
||||
case TS_SOLENOID_CATEGORY:
|
||||
if (!running) {
|
||||
doRunSolenoidBench(index, 300.0, 1000.0,
|
||||
doRunSolenoidBench(index, 1000.0,
|
||||
1000.0, engineConfiguration->benchTestCount);
|
||||
}
|
||||
break;
|
||||
|
||||
case TS_LUA_OUTPUT_CATEGORY:
|
||||
if (!running) {
|
||||
doRunBenchTestLuaOutput(index, 300.0, 4.0,
|
||||
doRunBenchTestLuaOutput(index, 4.0,
|
||||
engineConfiguration->benchTestOffTime, engineConfiguration->benchTestCount);
|
||||
}
|
||||
break;
|
||||
|
@ -554,12 +547,12 @@ void initBenchTest() {
|
|||
addConsoleActionF("fuelpumpbench2", fuelPumpBenchExt);
|
||||
|
||||
addConsoleActionFFF(CMD_FUEL_BENCH, fuelInjBench);
|
||||
addConsoleActionFFFFF("fuelbench2", fuelInjBenchExt);
|
||||
addConsoleActionFFFF("fuelbench2", fuelInjBenchExt);
|
||||
|
||||
addConsoleActionFFF(CMD_SPARK_BENCH, sparkBench);
|
||||
addConsoleActionFFFFF("sparkbench2", sparkBenchExt);
|
||||
addConsoleActionFFFF("sparkbench2", sparkBenchExt);
|
||||
|
||||
addConsoleActionFFFFF("tcusolbench", tcuSolenoidBench);
|
||||
addConsoleActionFFFF("tcusolbench", tcuSolenoidBench);
|
||||
|
||||
addConsoleAction(CMD_AC_RELAY_BENCH, acRelayBench);
|
||||
|
||||
|
@ -578,7 +571,7 @@ void initBenchTest() {
|
|||
addConsoleAction(CMD_MIL_BENCH, milBench);
|
||||
addConsoleAction(CMD_HPFP_BENCH, hpfpValveBench);
|
||||
|
||||
addConsoleActionFFFFF("luabench2", luaOutBench2);
|
||||
addConsoleActionFFFF("luabench2", luaOutBench2);
|
||||
instance.start();
|
||||
onConfigurationChangeBenchTest();
|
||||
}
|
||||
|
|
|
@ -136,8 +136,8 @@ void addConsoleActionFFF(const char *token, VoidFloatFloatFloat callback) {
|
|||
doAddAction(token, FLOAT_FLOAT_FLOAT_PARAMETER, (Void) callback, NULL);
|
||||
}
|
||||
|
||||
void addConsoleActionFFFFF(const char *token, VoidFloatFloatFloatFloatFloat callback) {
|
||||
doAddAction(token, FLOAT_FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER, (Void) callback, NULL);
|
||||
void addConsoleActionFFFF(const char *token, VoidFloatFloatFloatFloat callback) {
|
||||
doAddAction(token, FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER, (Void) callback, NULL);
|
||||
}
|
||||
|
||||
void addConsoleActionFFP(const char *token, VoidFloatFloatVoidPtr callback, void *param) {
|
||||
|
@ -165,8 +165,9 @@ static int getParameterCount(action_type_e parameterType) {
|
|||
case STRING3_PARAMETER:
|
||||
case FLOAT_FLOAT_FLOAT_PARAMETER:
|
||||
return 3;
|
||||
case FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER:
|
||||
return 4;
|
||||
case STRING5_PARAMETER:
|
||||
case FLOAT_FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER:
|
||||
return 5;
|
||||
default:
|
||||
return -1;
|
||||
|
@ -400,18 +401,18 @@ int handleActionWithParameter(TokenCallback *current, char *argv[], int argc) {
|
|||
(*callbackS)(value[0], value[1], value[2]);
|
||||
return 0;
|
||||
}
|
||||
case FLOAT_FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER:
|
||||
case FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER:
|
||||
{
|
||||
float value[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
float value[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
value[i] = atoff(argv[i]);
|
||||
if (cisnan(value[i])) {
|
||||
efiPrintf("invalid float [%s]", argv[i]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
VoidFloatFloatFloatFloatFloat callbackS = (VoidFloatFloatFloatFloatFloat) current->callback;
|
||||
(*callbackS)(value[0], value[1], value[2], value[3], value[4]);
|
||||
VoidFloatFloatFloatFloat callbackS = (VoidFloatFloatFloatFloat) current->callback;
|
||||
(*callbackS)(value[0], value[1], value[2], value[3]);
|
||||
return 0;
|
||||
}
|
||||
case INT_FLOAT_PARAMETER:
|
||||
|
|
|
@ -28,7 +28,7 @@ typedef enum {
|
|||
TWO_INTS_PARAMETER_P,
|
||||
FLOAT_FLOAT_PARAMETER,
|
||||
FLOAT_FLOAT_FLOAT_PARAMETER,
|
||||
FLOAT_FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER,
|
||||
FLOAT_FLOAT_FLOAT_FLOAT_PARAMETER,
|
||||
FLOAT_FLOAT_PARAMETER_P,
|
||||
INT_FLOAT_PARAMETER,
|
||||
} action_type_e;
|
||||
|
@ -71,7 +71,7 @@ void addConsoleActionNANF(const char *token, VoidFloat callback);
|
|||
|
||||
void addConsoleActionFF(const char *token, VoidFloatFloat callback);
|
||||
void addConsoleActionFFF(const char *token, VoidFloatFloatFloat callback);
|
||||
void addConsoleActionFFFFF(const char *token, VoidFloatFloatFloatFloatFloat callback);
|
||||
void addConsoleActionFFFF(const char *token, VoidFloatFloatFloatFloat callback);
|
||||
void addConsoleActionFFP(const char *token, VoidFloatFloatVoidPtr callback, void *param);
|
||||
|
||||
void addConsoleActionS(const char *token, VoidCharPtr callback);
|
||||
|
|
Loading…
Reference in New Issue