Nissan VVT trigger decoder #2887
This commit is contained in:
parent
9ad5ec8044
commit
2ad22a262b
|
@ -2084,7 +2084,7 @@ typedef enum {
|
|||
CUSTOM_ERR_TLE8888_RESPONSE = 6724,
|
||||
CUSTOM_ERR_CJ125_DIAG = 6725,
|
||||
CUSTOM_ERR_VVT_OUT_OF_RANGE = 6726,
|
||||
CUSTOM_ERR_6727 = 6727,
|
||||
CUSTOM_VVT_MODE_NOT_SELECTED = 6727,
|
||||
CUSTOM_ERR_6728 = 6728,
|
||||
CUSTOM_ERR_6729 = 6729,
|
||||
|
||||
|
|
|
@ -106,6 +106,9 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL
|
|||
}
|
||||
extern const char *vvtNames[];
|
||||
const char *vvtName = vvtNames[index];
|
||||
if (CONFIG(vvtMode[camIndex]) == VVT_INACTIVE) {
|
||||
warning(CUSTOM_VVT_MODE_NOT_SELECTED, "VVT: event on %d but no mode", camIndex);
|
||||
}
|
||||
|
||||
#if VR_HW_CHECK_MODE
|
||||
// some boards do not have hardware VR input LEDs which makes such boards harder to validate
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
int toothIndex;
|
||||
TriggerWaveform *form;
|
||||
bool isVvt;
|
||||
int vvtIndex;
|
||||
int vvtBankIndex;
|
||||
};
|
||||
|
||||
static void func(TriggerCallback *callback) {
|
||||
|
@ -26,7 +26,7 @@ static void func(TriggerCallback *callback) {
|
|||
efitick_t nowNt = getTimeNowNt();
|
||||
if (callback->isVvt) {
|
||||
trigger_value_e v = value ? TV_RISE : TV_FALL;
|
||||
hwHandleVvtCamSignal(v, nowNt, callback->vvtIndex PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
hwHandleVvtCamSignal(v, nowNt, callback->vvtBankIndex * CAMS_PER_BANK PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
} else {
|
||||
handleShaftSignal(0, value, nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static void scheduleTriggerEvents(TriggerWaveform *shape,
|
|||
float timeScale,
|
||||
int count,
|
||||
bool isVvt,
|
||||
int vvtIndex,
|
||||
int vvtBankIndex,
|
||||
int vvtOffset
|
||||
DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
int totalIndex = 0;
|
||||
|
@ -47,14 +47,14 @@ static void scheduleTriggerEvents(TriggerWaveform *shape,
|
|||
* and then execute those one
|
||||
*/
|
||||
for (int r = 0; r < count; r++) {
|
||||
for (int i = 0; i < shape->getSize(); i++) {
|
||||
for (size_t i = 0; i < shape->getSize(); i++) {
|
||||
float angle = vvtOffset + shape->getAngle(totalIndex);
|
||||
TriggerCallback *param = new TriggerCallback();
|
||||
param->engine = engine;
|
||||
param->toothIndex = totalIndex;
|
||||
param->form = shape;
|
||||
param->isVvt = isVvt;
|
||||
param->vvtIndex = vvtIndex;
|
||||
param->vvtBankIndex = vvtBankIndex;
|
||||
|
||||
scheduling_s *sch = new scheduling_s();
|
||||
engine->executor.scheduleByTimestamp(sch, timeScale * 1000 * angle, { func, param });
|
||||
|
@ -91,7 +91,7 @@ TEST(nissan, vq_vvt) {
|
|||
scheduleTriggerEvents(&vvt,
|
||||
/* timeScale */ vvtTimeScale,
|
||||
cyclesCount / 6, true,
|
||||
/* vvtIndex */ 0,
|
||||
/* vvtBankIndex */ 0,
|
||||
/* vvtOffset */ 0
|
||||
PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ TEST(nissan, vq_vvt) {
|
|||
scheduleTriggerEvents(&vvt,
|
||||
/* timeScale */ vvtTimeScale,
|
||||
cyclesCount / 6, true,
|
||||
/* vvtIndex */1,
|
||||
/* vvtBankIndex */1,
|
||||
/* vvtOffset */ offsetBetweenCams
|
||||
PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
@ -119,10 +119,12 @@ TEST(nissan, vq_vvt) {
|
|||
|
||||
|
||||
ASSERT_TRUE(tc->vvtState[0][0].getShaftSynchronized());
|
||||
//huh? ASSERT_TRUE(tc->vvtState[0][1].getShaftSynchronized());
|
||||
ASSERT_TRUE(tc->vvtState[1][0].getShaftSynchronized());
|
||||
|
||||
angle_t firstVVTangle = 27.5;
|
||||
ASSERT_NEAR(firstVVTangle, tc->vvtPosition[0][0], EPS2D);
|
||||
// hmm, why 340 not 360?
|
||||
ASSERT_EQ(firstVVTangle + 360 - 20, tc->vvtPosition[0][1]);
|
||||
ASSERT_NEAR(firstVVTangle + offsetBetweenCams, tc->vvtPosition[1][0], EPS2D);
|
||||
|
||||
// todo
|
||||
EXPECT_EQ(1, eth.recentWarnings()->getCount());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue