Solenoid test in console (#2178)

* give it a try

* create component

* add command maybe

* try

* try

* add pic

* try TCU_SOLENOID_COUNT

* try

* use injection and ignition count fields
This commit is contained in:
David Holdeman 2021-01-02 16:18:44 -06:00 committed by GitHub
parent 83cf734acb
commit c01389469b
3 changed files with 38 additions and 5 deletions

View File

@ -120,6 +120,16 @@ static void doRunFuel(int humanIndex, const char *delayStr, const char * onTimeS
pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.injectors[humanIndex - 1], b);
}
static void doTestSolenoid(int humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
const char *countStr) {
if (humanIndex < 1 || humanIndex > TCU_SOLENOID_COUNT) {
scheduleMsg(logger, "Invalid index: %d", humanIndex);
return;
}
brain_pin_e b = CONFIG(tcu_solenoid)[humanIndex - 1];
pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.tcuSolenoids[humanIndex - 1], b);
}
static void doBenchTestFsio(int humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr,
const char *countStr) {
if (humanIndex < 1 || humanIndex > FSIO_COMMAND_COUNT) {
@ -140,6 +150,16 @@ static void fuelbench2(const char *delayStr, const char *indexStr, const char *
doRunFuel(index, delayStr, onTimeStr, offTimeStr, countStr);
}
/**
* delay 100, solenoid #2, 1000ms ON, 1000ms OFF, repeat 3 times
* tcusolbench 100 2 1000 1000 3
*/
static void tcusolbench(const char *delayStr, const char *indexStr, const char * onTimeStr, const char *offTimeStr,
const char *countStr) {
int index = atoi(indexStr);
doTestSolenoid(index, delayStr, onTimeStr, offTimeStr, countStr);
}
/**
* delay 100, channel #1, 5ms ON, 1000ms OFF, repeat 3 times
* fsiobench2 100 1 5 1000 3
@ -409,6 +429,7 @@ void initBenchTest(Logging *sharedLogger) {
addConsoleAction(CMD_HPFP_BENCH, hpfpValveBench);
addConsoleActionSSSSS("fuelbench2", fuelbench2);
addConsoleActionSSSSS("tcusolbench", tcusolbench);
addConsoleActionSSSSS("fsiobench2", fsioBench2);
addConsoleActionSSSSS("sparkbench2", sparkbench2);
instance.setPeriod(200 /*ms*/);

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -28,6 +28,7 @@ public class BenchTestPane {
content.add(createFuelPumpTest());
content.add(createSparkTest());
content.add(createInjectorTest());
content.add(createSolenoidTest());
content.add(createMILTest());
content.add(createIdleTest());
content.add(createStarterTest());
@ -105,7 +106,7 @@ public class BenchTestPane {
}
private Component createSparkTest() {
final JComboBox<Integer> indexes = createIndexCombo();
final JComboBox<Integer> indexes = createIndexCombo(Fields.IGNITION_PIN_COUNT);
CommandControl panel = new CommandControl(uiContext,"Spark #", "spark.jpg", TEST, indexes) {
@Override
protected String getCommand() {
@ -116,7 +117,7 @@ public class BenchTestPane {
}
private Component createInjectorTest() {
final JComboBox<Integer> indexes = createIndexCombo();
final JComboBox<Integer> indexes = createIndexCombo(Fields.INJECTION_PIN_COUNT);
CommandControl panel = new CommandControl(uiContext,"Injector #", "injector.png", TEST, indexes) {
@Override
protected String getCommand() {
@ -126,10 +127,21 @@ public class BenchTestPane {
return panel.getContent();
}
private Component createSolenoidTest() {
final JComboBox<Integer> indexes = createIndexCombo(Fields.TCU_SOLENOID_COUNT);
CommandControl panel = new CommandControl(uiContext,"TCU Solenoid #", "solenoid.jpg", TEST, indexes) {
@Override
protected String getCommand() {
return "tcusolbench 1000 " + indexes.getSelectedItem() + " 1000 1000 3";
}
};
return panel.getContent();
}
@NotNull
private JComboBox<Integer> createIndexCombo() {
private JComboBox<Integer> createIndexCombo(Integer count) {
JComboBox<Integer> indexes = new JComboBox<>();
for (int i = 1; i <= 12; i++) {
for (int i = 1; i <= count; i++) {
indexes.addItem(i);
}
return indexes;
@ -139,4 +151,4 @@ public class BenchTestPane {
return content;
}
}
}