Trigger sync lost every 2^32 CPU cycles #1873

QA automation coverage
This commit is contained in:
rusefi 2020-10-11 19:16:16 -04:00
parent 99923b17b7
commit 16dd9a820b
1 changed files with 12 additions and 4 deletions

View File

@ -75,24 +75,32 @@ public class AutoTest extends BaseTest {
sendCommand("set " + CMD_ENGINESNIFFERRPMTHRESHOLD + " 100");
changeRpm(900);
// first let's get to expected RPM
assertRpmDoesNotJump(20000, 15, 30, FAIL, commandQueue);
assertRpmDoesNotJump(20000, 5, 40, FAIL, commandQueue);
}
private void testV12() {
setEngineType(ET_BMW_M73_F);
changeRpm(700);
// first let's get to expected RPM
assertRpmDoesNotJump(20000, 15, 30, FAIL, commandQueue);
assertRpmDoesNotJump(20000, 5, 40, FAIL, commandQueue);
testCaseBug1873();
}
private void testCaseBug1873() {
assertRpmDoesNotJump(60, 5, 110, FAIL, commandQueue);
}
public static void assertRpmDoesNotJump(int rpm, int settleTime, int testDuration, Function<String, Object> callback, CommandQueue commandQueue) {
IoUtil.changeRpm(commandQueue, rpm);
sleepSeconds(settleTime);
AtomicReference<String> result = new AtomicReference<>();
long start = System.currentTimeMillis();
SensorCentral.SensorListener listener = value -> {
double actualRpm = SensorCentral.getInstance().getValue(Sensor.RPM);
if (!isCloseEnough(rpm, actualRpm))
result.set("Got " + actualRpm + " while trying to stay at " + rpm);
if (!isCloseEnough(rpm, actualRpm)) {
long seconds = (System.currentTimeMillis() - start) / 1000;
result.set("Got " + actualRpm + " while trying to stay at " + rpm + " after " + seconds + " seconds");
}
};
SensorCentral.getInstance().addListener(Sensor.RPM, listener);
sleepSeconds(testDuration);