Trigger setup in TS is highly confusing: hide operation mode from users? #4031
WOW it works?!
This commit is contained in:
parent
298ea5f8c0
commit
20dbc1ff82
|
@ -100,7 +100,11 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
|
|||
}
|
||||
|
||||
static operation_mode_e lookupOperationMode() {
|
||||
return engineConfiguration->ambiguousOperationMode;
|
||||
if (engineConfiguration->twoStroke) {
|
||||
return TWO_STROKE;
|
||||
} else {
|
||||
return engineConfiguration->skippedWheelOnCam ? FOUR_STROKE_CAM_SENSOR : FOUR_STROKE_CRANK_SENSOR;
|
||||
}
|
||||
}
|
||||
|
||||
static void initVvtShape(int camIndex, TriggerState &initState) {
|
||||
|
|
|
@ -1175,17 +1175,14 @@ void prepareShapes() {
|
|||
#endif
|
||||
|
||||
void setTwoStrokeOperationMode() {
|
||||
engineConfiguration->ambiguousOperationMode = TWO_STROKE;
|
||||
engineConfiguration->twoStroke = true;
|
||||
}
|
||||
|
||||
void setCamOperationMode() {
|
||||
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
engineConfiguration->skippedWheelOnCam = true;
|
||||
}
|
||||
|
||||
void setCrankOperationMode() {
|
||||
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CRANK_SENSOR;
|
||||
engineConfiguration->skippedWheelOnCam = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -350,6 +350,7 @@ static void setInjectorLag(float voltage, float value) {
|
|||
setCurveValue(INJECTOR_LAG_CURVE, voltage, value);
|
||||
}
|
||||
|
||||
/*
|
||||
static void setToothedWheel(int total, int skipped) {
|
||||
if (total < 1 || skipped >= total) {
|
||||
efiPrintf("invalid parameters %d %d", total, skipped);
|
||||
|
@ -364,6 +365,7 @@ static void setToothedWheel(int total, int skipped) {
|
|||
incrementGlobalConfigurationVersion();
|
||||
doPrintConfiguration();
|
||||
}
|
||||
*/
|
||||
|
||||
static void setGlobalFuelCorrection(float value) {
|
||||
if (value < 0.01 || value > 50)
|
||||
|
@ -1207,7 +1209,7 @@ void initSettings(void) {
|
|||
addConsoleActionS(CMD_ENABLE, enable);
|
||||
addConsoleActionS(CMD_DISABLE, disable);
|
||||
|
||||
addConsoleActionII("set_toothed_wheel", setToothedWheel);
|
||||
// addConsoleActionII("set_toothed_wheel", setToothedWheel);
|
||||
|
||||
addConsoleActionFF("set_injector_lag", setInjectorLag);
|
||||
|
||||
|
|
|
@ -872,7 +872,6 @@ void onConfigurationChangeTriggerCallback() {
|
|||
}
|
||||
|
||||
changed |= isConfigurationChanged(trigger.type);
|
||||
changed |= isConfigurationChanged(ambiguousOperationMode);
|
||||
changed |= isConfigurationChanged(skippedWheelOnCam);
|
||||
changed |= isConfigurationChanged(twoStroke);
|
||||
changed |= isConfigurationChanged(useOnlyRisingEdgeForTrigger);
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
|
||||
#include "pch.h"
|
||||
|
||||
static void runRpmTest(operation_mode_e mode, int expected) {
|
||||
static void runRpmTest(bool isTwoStroke, bool isCam, int expected) {
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
engineConfiguration->ambiguousOperationMode = mode;
|
||||
engineConfiguration->twoStroke = isTwoStroke;
|
||||
engineConfiguration->skippedWheelOnCam = isCam;
|
||||
eth.setTriggerType(TT_ONE);
|
||||
|
||||
eth.smartFireTriggerEvents2(/*count*/200, /*delay*/ 40);
|
||||
|
@ -21,21 +22,14 @@ static void runRpmTest(operation_mode_e mode, int expected) {
|
|||
// todo: google test profiles one day?
|
||||
|
||||
TEST(engine, testRpmOfCamSensor) {
|
||||
runRpmTest(FOUR_STROKE_CAM_SENSOR, 1500);
|
||||
}
|
||||
|
||||
TEST(engine, testRpmOfSymmetricalCrank) {
|
||||
runRpmTest(FOUR_STROKE_SYMMETRICAL_CRANK_SENSOR, 375);
|
||||
runRpmTest(false, true, 1500);
|
||||
}
|
||||
|
||||
TEST(engine, testRpmOfTwoStroke) {
|
||||
runRpmTest(TWO_STROKE, 750);
|
||||
runRpmTest(true, false, 750);
|
||||
}
|
||||
|
||||
TEST(engine, testRpmOfCrankOnly) {
|
||||
runRpmTest(FOUR_STROKE_CRANK_SENSOR, 750);
|
||||
runRpmTest(false, false, 750);
|
||||
}
|
||||
|
||||
TEST(engine, testRpmOfThreeTimesCrank) {
|
||||
runRpmTest(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR, 250);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue