trigger and VSS hw integrated testing #1668
This commit is contained in:
parent
92bc869b59
commit
ba62727c25
|
@ -583,6 +583,11 @@ static void setIndividualPin(const char *pinName, brain_pin_e *targetPin, const
|
|||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
// set vss_pin
|
||||
static void setVssPin(const char *pinName) {
|
||||
setIndividualPin(pinName, &engineConfiguration->vehicleSpeedSensorInputPin, "VSS");
|
||||
}
|
||||
|
||||
// set_idle_pin none
|
||||
static void setIdlePin(const char *pinName) {
|
||||
setIndividualPin(pinName, &engineConfiguration->idle.solenoidPin, "idle");
|
||||
|
@ -1287,6 +1292,8 @@ static void setValue(const char *paramStr, const char *valueStr) {
|
|||
engineConfiguration->wwaeBeta = valueF;
|
||||
} else if (strEqualCaseInsensitive(paramStr, "cranking_dwell")) {
|
||||
engineConfiguration->ignitionDwellForCrankingMs = valueF;
|
||||
} else if (strEqualCaseInsensitive(paramStr, CMD_VSS_PIN)) {
|
||||
setVssPin(valueStr);
|
||||
} else if (strEqualCaseInsensitive(paramStr, "targetvbatt")) {
|
||||
engineConfiguration->targetVBatt = valueF;
|
||||
#if EFI_RTC
|
||||
|
@ -1347,7 +1354,7 @@ void initSettings(void) {
|
|||
addConsoleActionS("showpin", showPinFunction);
|
||||
addConsoleActionSS("set_injection_pin", setInjectionPin);
|
||||
addConsoleActionSS("set_ignition_pin", setIgnitionPin);
|
||||
addConsoleActionSS("set_trigger_input_pin", setTriggerInputPin);
|
||||
addConsoleActionSS(CMD_TRIGGER_PIN, setTriggerInputPin);
|
||||
addConsoleActionSS("set_trigger_simulator_pin", setTriggerSimulatorPin);
|
||||
|
||||
addConsoleActionSS("set_egt_cs_pin", (VoidCharPtrCharPtr) setEgtCSPin);
|
||||
|
|
|
@ -64,7 +64,6 @@ static void speedInfo(void) {
|
|||
engine->engineState.vssEventCounter,
|
||||
getVehicleSpeed());
|
||||
scheduleMsg(logger, "vss diff %d", vssDiff);
|
||||
|
||||
}
|
||||
|
||||
bool hasVehicleSpeedSensor() {
|
||||
|
|
|
@ -466,19 +466,6 @@ public class AutoTest extends BaseTest {
|
|||
assertWaveNull("hard limit check", chart, EngineChart.INJECTOR_1);
|
||||
}
|
||||
|
||||
private static void assertEquals(double expected, double actual) {
|
||||
assertEquals("", expected, actual);
|
||||
}
|
||||
|
||||
private static void assertEquals(String msg, double expected, double actual) {
|
||||
assertEquals(msg, expected, actual, EngineReport.RATIO);
|
||||
}
|
||||
|
||||
private static void assertEquals(String msg, double expected, double actual, double ratio) {
|
||||
if (!isCloseEnough(expected, actual, ratio))
|
||||
throw new IllegalStateException(msg + " Expected " + expected + " but got " + actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method waits for longer then usual.
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.functional_tests.BaseTest;
|
||||
import com.rusefi.io.CommandQueue;
|
||||
|
||||
import static com.rusefi.IoUtil.getDisableCommand;
|
||||
import static com.rusefi.IoUtil.getEnableCommand;
|
||||
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
|
||||
import static com.rusefi.config.generated.Fields.*;
|
||||
|
||||
public class HardwareTests extends BaseTest {
|
||||
|
@ -23,5 +26,16 @@ public class HardwareTests extends BaseTest {
|
|||
sendCommand(getDisableCommand(Fields.CMD_SELF_STIMULATION));
|
||||
changeRpm(1400);
|
||||
|
||||
// moving second trigger to another pin
|
||||
sendCommand(CMD_TRIGGER_PIN + " 1 PA8");
|
||||
|
||||
assertEquals("VSS no input", 0, SensorCentral.getInstance().getValue(Sensor.VSS));
|
||||
|
||||
// attaching VSS to trigger simulator since there is a jumper on test discovery
|
||||
sendCommand("set " + CMD_VSS_PIN + " pa5");
|
||||
|
||||
sleep(2 * Timeouts.SECOND);
|
||||
|
||||
assertEquals("VSS with input", 3, SensorCentral.getInstance().getValue(Sensor.VSS));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,12 @@ import com.rusefi.IoUtil;
|
|||
import com.rusefi.Timeouts;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.io.CommandQueue;
|
||||
import com.rusefi.waves.EngineReport;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.IoUtil.getEnableCommand;
|
||||
import static com.rusefi.IoUtil.sleepSeconds;
|
||||
import static com.rusefi.waves.EngineReport.isCloseEnough;
|
||||
|
||||
public class BaseTest {
|
||||
private static final Logging log = getLogging(BaseTest.class);
|
||||
|
@ -21,6 +23,19 @@ public class BaseTest {
|
|||
this.commandQueue = commandQueue;
|
||||
}
|
||||
|
||||
protected static void assertEquals(double expected, double actual) {
|
||||
BaseTest.assertEquals("", expected, actual);
|
||||
}
|
||||
|
||||
protected static void assertEquals(String msg, double expected, double actual) {
|
||||
BaseTest.assertEquals(msg, expected, actual, EngineReport.RATIO);
|
||||
}
|
||||
|
||||
protected static void assertEquals(String msg, double expected, double actual, double ratio) {
|
||||
if (!isCloseEnough(expected, actual, ratio))
|
||||
throw new IllegalStateException(msg + " Expected " + expected + " but got " + actual);
|
||||
}
|
||||
|
||||
protected void sendCommand(String command) {
|
||||
sendCommand(command, CommandQueue.DEFAULT_TIMEOUT, Timeouts.CMD_TIMEOUT);
|
||||
}
|
||||
|
@ -47,7 +62,7 @@ public class BaseTest {
|
|||
// sendCommand(CMD_PINS);
|
||||
sendCommand("set " + Fields.CMD_ENGINE_TYPE + " " + type, COMPLEX_COMMAND_RETRY, Timeouts.SET_ENGINE_TIMEOUT);
|
||||
// TODO: document the reason for this sleep?!
|
||||
sleepSeconds(1);
|
||||
sleepSeconds(3);
|
||||
sendCommand(getEnableCommand(Fields.CMD_SELF_STIMULATION));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PortDetector {
|
|||
} catch (InterruptedException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
// FileLog.MAIN.logLine("Found " + result.get());
|
||||
log.debug("Found " + result.get() + " now stopping threads");
|
||||
for (Thread thread : serialFinder)
|
||||
thread.interrupt();
|
||||
// FileLog.MAIN.logLine("Returning " + result.get());
|
||||
|
|
|
@ -171,7 +171,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
|
|||
};
|
||||
}
|
||||
|
||||
public static void sleep(int millis) {
|
||||
public static void sleep(long millis) {
|
||||
try {
|
||||
Thread.sleep(millis);
|
||||
} catch (InterruptedException e) {
|
||||
|
|
Loading…
Reference in New Issue