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