From 2ae15b5bab597ecf82fb6f7d92b6aa3afc12a173 Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 9 Mar 2020 16:59:19 -0400 Subject: [PATCH] hard-coding miata Nb2 VVT Ratio magic --- firmware/config/engines/mazda_miata_vvt.cpp | 6 ------ firmware/controllers/engine_controller.cpp | 2 +- .../controllers/trigger/trigger_central.cpp | 8 +++++--- firmware/integration/rusefi_config.txt | 4 ++-- firmware/tunerstudio/rusefi.input | 2 -- .../com/rusefi/config/generated/Fields.java | 18 +++++++++--------- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index f69d8f13b0..acfd5185b5 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -193,12 +193,6 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { setCommonNTCSensor(&engineConfiguration->clt, 2700); setCommonNTCSensor(&engineConfiguration->iat, 2700); - // 0.0825 - // 0.1375 - // 6.375 - // 10.625 - engineConfiguration->miataNb2VVTRatioFrom = 8.50 * 0.75; - engineConfiguration->miataNb2VVTRatioTo = 14; engineConfiguration->nbVvtIndex = 0; engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 364f881960..6d3fbfdc9d 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -849,6 +849,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 201200308; + return 201200309; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 248cc32c67..4fc972fe45 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -86,6 +86,10 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E engine->triggerCentral.addEventListener(listener, name, engine); } +#define miataNb2VVTRatioFrom (8.50 * 0.75) +#define miataNb2VVTRatioTo (14) + + void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { TriggerCentral *tc = &engine->triggerCentral; if (front == TV_RISE) { @@ -121,7 +125,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt DECLARE_ENGINE_ if (engineConfiguration->verboseTriggerSynchDetails) { scheduleMsg(logger, "vvt ratio %.2f", ratio); } - if (ratio < CONFIG(miataNb2VVTRatioFrom) || ratio > CONFIG(miataNb2VVTRatioTo)) { + if (ratio < miataNb2VVTRatioFrom || ratio > miataNb2VVTRatioTo) { return; } if (engineConfiguration->verboseTriggerSynchDetails) { @@ -662,8 +666,6 @@ void onConfigurationChangeTriggerCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { isConfigurationChanged(vvtCamSensorUseRise) || isConfigurationChanged(vvtOffset) || isConfigurationChanged(vvtDisplayInverted) || - isConfigurationChanged(miataNb2VVTRatioFrom) || - isConfigurationChanged(miataNb2VVTRatioTo) || isConfigurationChanged(nbVvtIndex); if (changed) { assertEngineReference(); diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 8f42f5ab0c..38d92d9e63 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -681,8 +681,8 @@ custom uart_device_e 1 bits,U32, @OFFSET@, [0:7], "Off", "UART1", "UART2", "UA int mapMinBufferLength;;"count", 1, 0, 0, 24, 0 int16_t idlePidDeactivationTpsThreshold;;"%", 1, 0, 0, 100.0, 0 int16_t stepperParkingExtraSteps;;"%", 1, 0, 0, 3000.0, 0 - float miataNb2VVTRatioFrom;This magic property is specific to Mazda Miata NB2;"value", 1, 0, 0, 1000, 5 - float miataNb2VVTRatioTo;This magic property is specific to Mazda Miata NB2;"value", 1, 0, 0, 1000, 5 + float unusedmiataNb2VVTRatioFrom;This magic property is specific to Mazda Miata NB2;"value", 1, 0, 0, 1000, 5 + float unusedmiataNb2VVTRatioTo;This magic property is specific to Mazda Miata NB2;"value", 1, 0, 0, 1000, 5 brain_pin_e triggerErrorPin;+This pin is used for debugging - snap a logic analyzer on it and see if it's ever high pin_output_mode_e triggerErrorPinMode; diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index cc0c3f9fa8..928169fc22 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1547,8 +1547,6 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "VVT use rise front", vvtCamSensorUseRise, {trigger_type != 80} field = "VVT position display offset", vvtOffset field = "VVT display inverted", vvtDisplayInverted - field = "Miata NB2 from (temporary)", miataNb2VVTRatioFrom - field = "Miata NB2 to (temporary)", miataNb2VVTRatioTo field = "nbVvtIndex", nbVvtIndex field = "print verbose sync details to console",verboseTriggerSynchDetails field = "Do not print messages in case of sync error", silentTriggerError diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index 4a28251507..8046e75e68 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sun Mar 08 09:00:07 EDT 2020 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Mon Mar 09 16:42:12 EDT 2020 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -1034,10 +1034,6 @@ public class Fields { public static final int mc33972_csPinMode_offset = 679; public static final int mc33972spiDevice_offset = 4008; public static final int measureMapOnlyInOneCylinder_offset = 744; - public static final int miataNb2VVTRatioFrom_offset = 820; - public static final int miataNb2VVTRatioFrom_offset_hex = 334; - public static final int miataNb2VVTRatioTo_offset = 824; - public static final int miataNb2VVTRatioTo_offset_hex = 338; public static final String MOCK_AFR_COMMAND = "mock_afr_voltage"; public static final String MOCK_CLT_COMMAND = "mock_clt_voltage"; public static final String MOCK_IAT_COMMAND = "mock_iat_voltage"; @@ -1405,6 +1401,10 @@ public class Fields { public static final int unusedFlexFuelSensor_offset = 3100; public static final int unusedFormerWarmupAfrPid_offset = 1772; public static final int unusedHereWeHave_offset = 756; + public static final int unusedmiataNb2VVTRatioFrom_offset = 820; + public static final int unusedmiataNb2VVTRatioFrom_offset_hex = 334; + public static final int unusedmiataNb2VVTRatioTo_offset = 824; + public static final int unusedmiataNb2VVTRatioTo_offset_hex = 338; public static final int unusedOldWarmupAfr_offset = 744; public static final int unusedSomething_offset = 1784; public static final int unusedSpiPadding4_offset = 2593; @@ -1841,8 +1841,8 @@ public class Fields { public static final Field MAPMINBUFFERLENGTH = Field.create("MAPMINBUFFERLENGTH", 812, FieldType.INT); public static final Field IDLEPIDDEACTIVATIONTPSTHRESHOLD = Field.create("IDLEPIDDEACTIVATIONTPSTHRESHOLD", 816, FieldType.INT16); public static final Field STEPPERPARKINGEXTRASTEPS = Field.create("STEPPERPARKINGEXTRASTEPS", 818, FieldType.INT16); - public static final Field MIATANB2VVTRATIOFROM = Field.create("MIATANB2VVTRATIOFROM", 820, FieldType.FLOAT); - public static final Field MIATANB2VVTRATIOTO = Field.create("MIATANB2VVTRATIOTO", 824, FieldType.FLOAT); + public static final Field UNUSEDMIATANB2VVTRATIOFROM = Field.create("UNUSEDMIATANB2VVTRATIOFROM", 820, FieldType.FLOAT); + public static final Field UNUSEDMIATANB2VVTRATIOTO = Field.create("UNUSEDMIATANB2VVTRATIOTO", 824, FieldType.FLOAT); public static final Field TRIGGERERRORPIN = Field.create("TRIGGERERRORPIN", 828, FieldType.INT8, brain_pin_e); public static final Field TRIGGERERRORPINMODE = Field.create("TRIGGERERRORPINMODE", 829, FieldType.INT8, pin_output_mode_e); public static final Field ACRELAYPIN = Field.create("ACRELAYPIN", 830, FieldType.INT8, output_pin_e); @@ -2739,8 +2739,8 @@ public class Fields { MAPMINBUFFERLENGTH, IDLEPIDDEACTIVATIONTPSTHRESHOLD, STEPPERPARKINGEXTRASTEPS, - MIATANB2VVTRATIOFROM, - MIATANB2VVTRATIOTO, + UNUSEDMIATANB2VVTRATIOFROM, + UNUSEDMIATANB2VVTRATIOTO, TRIGGERERRORPIN, TRIGGERERRORPINMODE, ACRELAYPIN,