mirror of https://github.com/rusefi/rusefi-1.git
JNI for test coverage #3965
This commit is contained in:
parent
930825e84f
commit
24c3237577
|
@ -1,6 +1,7 @@
|
||||||
package com.rusefi.native_;
|
package com.rusefi.native_;
|
||||||
|
|
||||||
import com.rusefi.core.Sensor;
|
import com.rusefi.core.Sensor;
|
||||||
|
import com.rusefi.enums.SensorType;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -25,7 +26,17 @@ public class JniUnitTest {
|
||||||
assertEquals(TS_FILE_VERSION, (int) getValue(outputs, Sensor.FIRMWARE_VERSION));
|
assertEquals(TS_FILE_VERSION, (int) getValue(outputs, Sensor.FIRMWARE_VERSION));
|
||||||
|
|
||||||
assertEquals(14.0, getValue(outputs, Sensor.TARGET_AFR));
|
assertEquals(14.0, getValue(outputs, Sensor.TARGET_AFR));
|
||||||
// assertEquals(1, getValue(outputs, Sensor.veValue));
|
double veValue = getValue(outputs, Sensor.veValue);
|
||||||
|
assertTrue("veValue", veValue > 40 && veValue < 90);
|
||||||
|
|
||||||
|
assertEquals(18.11, getValue(outputs, Sensor.runningFuel));
|
||||||
|
|
||||||
|
engineLogic.setSensor(SensorType.Rpm.name(), 4000);
|
||||||
|
engineLogic.invokePeriodicCallback();
|
||||||
|
// huh?
|
||||||
|
assertEquals(0.0, getValue(outputs, Sensor.RPM));
|
||||||
|
|
||||||
|
assertEquals(18.11, getValue(outputs, Sensor.runningFuel));
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getValue(byte[] outputs, Sensor sensor) {
|
private double getValue(byte[] outputs, Sensor sensor) {
|
||||||
|
|
|
@ -55,10 +55,11 @@ public enum Sensor {
|
||||||
crankingFuel(GAUGE_NAME_FUEL_CRANKING, SensorCategory.FUEL, FieldType.UINT16, 46, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
|
crankingFuel(GAUGE_NAME_FUEL_CRANKING, SensorCategory.FUEL, FieldType.UINT16, 46, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
|
||||||
TARGET_AFR(GAUGE_NAME_TARGET_AFR, SensorCategory.OPERATIONS, FieldType.INT16, 48, 1.0 / PACK_MULT_AFR, 10, 20, "afr"),
|
TARGET_AFR(GAUGE_NAME_TARGET_AFR, SensorCategory.OPERATIONS, FieldType.INT16, 48, 1.0 / PACK_MULT_AFR, 10, 20, "afr"),
|
||||||
baseFuel(Fields.GAUGE_NAME_FUEL_BASE, SensorCategory.FUEL, FieldType.UINT16, 50, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
|
baseFuel(Fields.GAUGE_NAME_FUEL_BASE, SensorCategory.FUEL, FieldType.UINT16, 50, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
|
||||||
runningFuel(GAUGE_NAME_FUEL_RUNNING, SensorCategory.FUEL, FieldType.UINT16, 52, 1.0 / PACK_MULT_MS, 0, 15, "ms"),
|
runningFuel(GAUGE_NAME_FUEL_RUNNING, SensorCategory.FUEL, FieldType.UINT16, 52, 1.0 / PACK_MULT_FUEL_MASS, 0, 15, "ms"),
|
||||||
actualLastInjection(GAUGE_NAME_FUEL_LAST_INJECTION, SensorCategory.FUEL, FieldType.UINT16, 54, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
|
actualLastInjection(GAUGE_NAME_FUEL_LAST_INJECTION, SensorCategory.FUEL, FieldType.UINT16, 54, 1.0 / PACK_MULT_MS, 0, 30, "ms"),
|
||||||
injectorDutyCycle(Fields.GAUGE_NAME_FUEL_INJ_DUTY, SensorCategory.FUEL, FieldType.UINT8, 56, 0.5, 0, 100, "%"),
|
injectorDutyCycle(Fields.GAUGE_NAME_FUEL_INJ_DUTY, SensorCategory.FUEL, FieldType.UINT8, 56, 0.5, 0, 100, "%"),
|
||||||
veValue(GAUGE_NAME_FUEL_VE, SensorCategory.FUEL, FieldType.FLOAT, 57, 0.5, 0, 100, "%"),
|
veValue(GAUGE_NAME_FUEL_VE, SensorCategory.FUEL, FieldType.UINT8, 57, 0.5, 0, 100, "%"),
|
||||||
|
// injectionOffset
|
||||||
tCharge(GAUGE_NAME_TCHARGE, SensorCategory.FUEL, FieldType.FLOAT, 60, 1.0 / PACK_MULT_TEMPERATURE, 30, 140, "C"),
|
tCharge(GAUGE_NAME_TCHARGE, SensorCategory.FUEL, FieldType.FLOAT, 60, 1.0 / PACK_MULT_TEMPERATURE, 30, 140, "C"),
|
||||||
|
|
||||||
// Corrections
|
// Corrections
|
||||||
|
|
Loading…
Reference in New Issue