benchTest flexibility

This commit is contained in:
rusefillc 2022-01-03 03:35:26 -05:00
parent 51ade79641
commit 21f3f26506
3 changed files with 24 additions and 5 deletions

View File

@ -29,6 +29,7 @@
#include "flash_main.h"
#include "hip9011_logic.h"
#include "bench_test.h"
#if EFI_MEMS
#include "accelerometer.h"
@ -186,6 +187,10 @@ void incrementGlobalConfigurationVersion() {
onConfigurationChangeElectronicThrottleCallback(&activeConfiguration);
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
#if EFI_ENGINE_CONTROL && EFI_PROD_CODE
onConfigurationChangeBenchTest();
#endif
#if EFI_SHAFT_POSITION_INPUT
onConfigurationChangeTriggerCallback();
#endif /* EFI_SHAFT_POSITION_INPUT */

View File

@ -52,6 +52,9 @@
#endif // BOARD_TLE8888_COUNT
static bool isRunningBench = false;
// yes that's a bit lazy/crazy to have those as strings
static char offTimeBuffer[8];
static char counterBuffer[8];
bool isRunningBenchTest(void) {
return isRunningBench;
@ -223,7 +226,7 @@ void mainRelayBench(void) {
}
void hpfpValveBench(void) {
pinbench(/*delay*/"1000", /* onTime */"20", /*offtime*/"500", "3", &enginePins.hpfpValve, engineConfiguration->hpfpValvePin);
pinbench(/*delay*/"1000", /* onTime */"20", offTimeBuffer, counterBuffer, &enginePins.hpfpValve, engineConfiguration->hpfpValvePin);
}
void fuelPumpBench(void) {
@ -437,25 +440,25 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
case TS_IGNITION_CATEGORY:
if (!running) {
doRunSpark(index, "300", "4", "400", "3");
doRunSpark(index, "300", "4", offTimeBuffer, counterBuffer);
}
break;
case TS_INJECTOR_CATEGORY:
if (!running) {
doRunFuel(index, "300", /*onTime*/"4", /*offTime*/"400", "3");
doRunFuel(index, "300", /*onTime*/"4", offTimeBuffer, counterBuffer);
}
break;
case CMD_TS_SOLENOID_CATEGORY:
if (!running) {
doTestSolenoid(index, "300", "1000", "1000", "3");
doTestSolenoid(index, "300", "1000", "1000", counterBuffer);
}
break;
case CMD_TS_FSIO_CATEGORY:
if (!running) {
doBenchTestFsio(index, "300", "4", "400", "3");
doBenchTestFsio(index, "300", "4", offTimeBuffer, counterBuffer);
}
break;
@ -514,6 +517,15 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) {
}
}
void onConfigurationChangeBenchTest() {
if (engineConfiguration->benchTestOffTime < 5)
engineConfiguration->benchTestOffTime = 500; // default value if configuration was not specified
if (engineConfiguration->benchTestCount < 1)
engineConfiguration->benchTestOffTime = 3; // default value if configuration was not specified
itoa10(offTimeBuffer, engineConfiguration->benchTestOffTime);
itoa10(counterBuffer, engineConfiguration->benchTestCount);
}
void initBenchTest() {
addConsoleAction("fuelpumpbench", fuelPumpBench);
addConsoleAction(CMD_AC_RELAY_BENCH, acRelayBench);
@ -540,6 +552,7 @@ void initBenchTest() {
addConsoleActionSSSSS("sparkbench2", sparkbench2);
instance.setPeriod(200 /*ms*/);
instance.Start();
onConfigurationChangeBenchTest();
}
#endif /* EFI_UNIT_TEST */

View File

@ -13,6 +13,7 @@
#include "global.h"
void initBenchTest();
void onConfigurationChangeBenchTest();
bool isRunningBenchTest(void);