bugfix: set_toothed_wheel command

This commit is contained in:
rusefi 2017-02-23 08:20:24 -05:00
parent 4ffa5f6803
commit 227528c8fe
2 changed files with 11 additions and 1 deletions

View File

@ -518,7 +518,14 @@ static void setTriggerType(int value) {
}
static void setToothedWheel(int total, int skipped DECLARE_ENGINE_PARAMETER_S) {
if (total < 1 || skipped >= total) {
scheduleMsg(&logger, "invalid parameters %d %d", total, skipped);
return;
}
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
engineConfiguration->trigger.customTotalToothCount = total;
engineConfiguration->trigger.customSkippedToothCount = skipped;
scheduleMsg(&logger, "toothed: total=%d/skipped=%d", total, skipped);
setToothedWheelConfiguration(&engine->triggerShape, total, skipped, engineConfiguration->operationMode);
// initializeTriggerShape(&logger, engineConfiguration, engineConfiguration2);

View File

@ -30,7 +30,10 @@ void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int to
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
operation_mode_e operationMode DECLARE_ENGINE_PARAMETER_S) {
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
if (totalTeethCount <= 0) {
firmwareError(CUSTOM_ERR_6143, "totalTeethCount is zero or less: %d", totalTeethCount);
return;
}
efiAssertVoid(s != NULL, "TriggerShape is NULL");
s->initialize(operationMode, false);