ETB JNI test progress
This commit is contained in:
parent
4dd9217327
commit
76e74e173f
|
@ -19,5 +19,7 @@ public class EngineLogic {
|
||||||
|
|
||||||
public native void invokePeriodicCallback();
|
public native void invokePeriodicCallback();
|
||||||
|
|
||||||
|
public native void invokeEtbCycle();
|
||||||
|
|
||||||
public native byte[] getOutputs();
|
public native byte[] getOutputs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,13 @@ public class JniUnitTest {
|
||||||
assertEquals(2.45, getField(engineLogic, Fields.GEARRATIO1));
|
assertEquals(2.45, getField(engineLogic, Fields.GEARRATIO1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEtbStuff() {
|
||||||
|
JniSandbox.loadLibrary();
|
||||||
|
|
||||||
|
EngineLogic engineLogic = new EngineLogic();
|
||||||
|
}
|
||||||
|
|
||||||
private double getField(EngineLogic engineLogic, Field field) {
|
private double getField(EngineLogic engineLogic, Field field) {
|
||||||
byte[] configuration = engineLogic.getConfiguration();
|
byte[] configuration = engineLogic.getConfiguration();
|
||||||
assertNotNull("configuration", configuration);
|
assertNotNull("configuration", configuration);
|
||||||
|
|
|
@ -55,6 +55,14 @@ JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setEngineType
|
||||||
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokePeriodicCallback
|
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokePeriodicCallback
|
||||||
(JNIEnv *, jobject);
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_rusefi_native__EngineLogic
|
||||||
|
* Method: invokeEtbCycle
|
||||||
|
* Signature: ()V
|
||||||
|
*/
|
||||||
|
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokeEtbCycle
|
||||||
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: com_rusefi_native__EngineLogic
|
* Class: com_rusefi_native__EngineLogic
|
||||||
* Method: getOutputs
|
* Method: getOutputs
|
||||||
|
|
|
@ -75,6 +75,18 @@ JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokePeriodicCallba
|
||||||
eth->engine.periodicFastCallback();
|
eth->engine.periodicFastCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokeEtbCycle
|
||||||
|
(JNIEnv *, jobject) {
|
||||||
|
EngineTestHelper* eth = getEth();
|
||||||
|
Engine *engine = ð->engine;
|
||||||
|
|
||||||
|
for (int i = 0; i < ETB_COUNT; i++) {
|
||||||
|
if (auto etb = engine->etbControllers[i]) {
|
||||||
|
etb->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT jbyteArray JNICALL Java_com_rusefi_native_1_EngineLogic_getOutputs(JNIEnv * env, jobject instance) {
|
JNIEXPORT jbyteArray JNICALL Java_com_rusefi_native_1_EngineLogic_getOutputs(JNIEnv * env, jobject instance) {
|
||||||
jbyteArray retVal = env->NewByteArray(TS_TOTAL_OUTPUT_SIZE);
|
jbyteArray retVal = env->NewByteArray(TS_TOTAL_OUTPUT_SIZE);
|
||||||
jbyte *buf = env->GetByteArrayElements(retVal, NULL);
|
jbyte *buf = env->GetByteArrayElements(retVal, NULL);
|
||||||
|
|
Loading…
Reference in New Issue