Trigger setup in TS is highly confusing: hide operation mode from users? #4031

This commit is contained in:
Andrey 2022-04-03 01:38:52 -04:00
parent 6c69e55ea0
commit 49fab25b14
3 changed files with 8 additions and 6 deletions

View File

@ -99,6 +99,10 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) {
}
}
static operation_mode_e lookupOperationMode() {
return engineConfiguration->ambiguousOperationMode;
}
static void initVvtShape(int camIndex, TriggerState &initState) {
vvt_mode_e vvtMode = engineConfiguration->vvtMode[camIndex];
@ -109,7 +113,7 @@ static void initVvtShape(int camIndex, TriggerState &initState) {
auto& shape = engine->triggerCentral.vvtShape[camIndex];
shape.initializeTriggerWaveform(
engineConfiguration->ambiguousOperationMode,
lookupOperationMode(),
engineConfiguration->vvtCamSensorUseRise, &config);
shape.initializeSyncPoint(initState,
@ -132,7 +136,7 @@ void Engine::updateTriggerWaveform() {
chibios_rt::CriticalSectionLocker csl;
TRIGGER_WAVEFORM(initializeTriggerWaveform(
engineConfiguration->ambiguousOperationMode,
lookupOperationMode(),
engineConfiguration->useOnlyRisingEdgeForTrigger, &engineConfiguration->trigger));
/**
@ -612,7 +616,7 @@ operation_mode_e Engine::getOperationMode() {
* here we ignore user-provided setting for well known triggers.
* For instance for Miata NA, there is no reason to allow user to set FOUR_STROKE_CRANK_SENSOR
*/
return doesTriggerImplyOperationMode(engineConfiguration->trigger.type) ? triggerCentral.triggerShape.getOperationMode() : engineConfiguration->ambiguousOperationMode;
return doesTriggerImplyOperationMode(engineConfiguration->trigger.type) ? triggerCentral.triggerShape.getOperationMode() : lookupOperationMode();
}
/**

View File

@ -1148,8 +1148,6 @@ static void setValue(const char *paramStr, const char *valueStr) {
engineConfiguration->vvtOffsets[0] = valueF;
} else if (strEqualCaseInsensitive(paramStr, "vvt_mode")) {
engineConfiguration->vvtMode[0] = (vvt_mode_e)valueI;
} else if (strEqualCaseInsensitive(paramStr, "operation_mode")) {
engineConfiguration->ambiguousOperationMode = (operation_mode_e)valueI;
} else if (strEqualCaseInsensitive(paramStr, "vvtCamSensorUseRise")) {
engineConfiguration->vvtCamSensorUseRise = valueI;
} else if (strEqualCaseInsensitive(paramStr, "wwaeTau")) {

View File

@ -73,7 +73,7 @@ class TriggerConfiguration;
class TriggerWaveform {
public:
TriggerWaveform();
void initializeTriggerWaveform(operation_mode_e ambiguousOperationMode,
void initializeTriggerWaveform(operation_mode_e triggerOperationMode,
bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig);
void setShapeDefinitionError(bool value);