Nissan VVT trigger decoder #2887
another bug - improper handling of three-times-symmetrical
This commit is contained in:
parent
293bf45763
commit
70424ac7b5
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "engine_configuration.h"
|
||||
|
||||
#define NISSAN_VQ_VVT_OFFSET -577.5
|
||||
#define NISSAN_VQ_CAM_OFFSET 360
|
||||
#define NISSAN_VQ_VVT_OFFSET -610
|
||||
#define NISSAN_VQ_CAM_OFFSET -360
|
||||
|
||||
void setHellen121nissan(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -501,11 +501,18 @@ bool TriggerNoiseFilter::noiseFilter(efitick_t nowNt,
|
|||
* todo: why is this method NOT reciprocal to getRpmMultiplier?!
|
||||
*/
|
||||
int getCrankDivider(operation_mode_e operationMode) {
|
||||
if (operationMode == FOUR_STROKE_CAM_SENSOR || operationMode == TWO_STROKE) {
|
||||
switch (operationMode) {
|
||||
case FOUR_STROKE_CRANK_SENSOR:
|
||||
return 2;
|
||||
case FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR:
|
||||
return SYMMETRICAL_CRANK_SENSOR_DIVIDER;
|
||||
case FOUR_STROKE_THREE_TIMES_CRANK_SENSOR:
|
||||
return SYMMETRICAL_THREE_TIMES_CRANK_SENSOR_DIVIDER;
|
||||
default:
|
||||
case FOUR_STROKE_CAM_SENSOR:
|
||||
case TWO_STROKE:
|
||||
// That's easy - trigger cycle matches engine cycle
|
||||
return 1;
|
||||
} else {
|
||||
return operationMode == FOUR_STROKE_CRANK_SENSOR ? 2 : SYMMETRICAL_CRANK_SENSOR_DIVIDER;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ TEST(nissan, vq_vvt) {
|
|||
}
|
||||
float vvtTimeScale = 1;
|
||||
|
||||
angle_t testVvtOffset = 19;
|
||||
angle_t testVvtOffset = 13;
|
||||
|
||||
{
|
||||
static TriggerWaveform vvt;
|
||||
|
@ -113,7 +113,7 @@ TEST(nissan, vq_vvt) {
|
|||
eth.setTimeAndInvokeEventsUs(head->momentX);
|
||||
}
|
||||
|
||||
ASSERT_EQ(250, GET_RPM());
|
||||
ASSERT_EQ(167, GET_RPM());
|
||||
|
||||
TriggerCentral *tc = &engine->triggerCentral;
|
||||
|
||||
|
@ -121,8 +121,9 @@ TEST(nissan, vq_vvt) {
|
|||
ASSERT_TRUE(tc->vvtState[0][0].getShaftSynchronized());
|
||||
ASSERT_TRUE(tc->vvtState[1][0].getShaftSynchronized());
|
||||
|
||||
ASSERT_NEAR(-testVvtOffset * 1.5, tc->vvtPosition[0][0], EPS2D);
|
||||
// ASSERT_NEAR(-testVvtOffset * 1.5, tc->vvtPosition[1][0], EPS2D);
|
||||
ASSERT_NEAR(-testVvtOffset, tc->vvtPosition[0][0], EPS2D);
|
||||
ASSERT_NEAR(-testVvtOffset, tc->vvtPosition[1][0], EPS2D);
|
||||
|
||||
//todo EXPECT_EQ(0, eth.recentWarnings()->getCount());
|
||||
// todo: reducing warning here is a separate story
|
||||
EXPECT_EQ(1, eth.recentWarnings()->getCount());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue