diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index ecd82d47c3..ee4ab6c268 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -531,6 +531,8 @@ case ES_NarrowBand: return "ES_NarrowBand"; case ES_PLX: return "ES_PLX"; +case ES_Custom: + return "ES_Custom"; case Force_4b_ego_sensor: return "Force_4b_ego_sensor"; } diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index 2f74057627..4e709d3e6f 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Oct 16 14:44:28 EDT 2017 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Oct 29 20:03:49 EDT 2017 // begin #ifndef ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_ @@ -1795,9 +1795,14 @@ typedef struct { */ pin_output_mode_e cj125CsPinMode; /** + * Narrow Band WBO Approximation * offset 2488 */ - float unusedauxPid[16]; + float narrowToWideOxygenBins[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE]; + /** + * offset 2520 + */ + float narrowToWideOxygen[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE]; /** * set vvt_mode X * offset 2552 @@ -2158,4 +2163,4 @@ typedef struct { #endif // end -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Oct 16 14:44:28 EDT 2017 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Oct 29 20:03:49 EDT 2017 diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index a7338be232..3de5f790a2 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -520,6 +520,8 @@ typedef enum { ES_PLX = 4, + ES_Custom = 5, + Force_4b_ego_sensor = ENUM_32_BITS, } ego_sensor_e; diff --git a/firmware/controllers/algo/rusefi_generated.h b/firmware/controllers/algo/rusefi_generated.h index 0e2e390314..9cf5cb6c3c 100644 --- a/firmware/controllers/algo/rusefi_generated.h +++ b/firmware/controllers/algo/rusefi_generated.h @@ -57,7 +57,7 @@ #define engine_load_mode_e_enum "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY" #define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Miata NB", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Honda 4+24+1", "Mitsubishi", "Honda 4+24", "Honda 1+4+24", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "1+60/2", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Honda 1+24", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "2JZ", "Rover K", "GM LS 24", "Honda CBR 600", "2JZ_1_12", "Honda CBR 600 custom", "3/1 skipped" , "Dodge Neon 2003 crank", "Miata VVT", "trg34", "trg35", "Subaru 7+6", "Jeep 18-2-2-2", "WIP", "trg39", "trg40", "trg41", "trg42", "INVALID" #define sensor_chart_e_enum "none", "trigger", "MAP", "RPM ACCEL", "DETAILED RPM", "INVALID" -#define ego_sensor_e_enum "BPSX", "Innovate", "14Point7", "Narrow", "PLX" +#define ego_sensor_e_enum "BPSX", "Innovate", "14Point7", "Narrow", "PLX", "Custom" #define pin_mode_e_enum "default", "INVALID", "INVALID", "INVALID", "opendrain", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "mode12", "mode13", "mode14", "mode15", "mode16", "mode17", "mode18", "mode19", "mode20", "mode21", "mode22", "mode23", "mode24", "mode25", "mode26", "mode27", "mode28", "mode29", "mode30", "mode31", "PULLUP", "mode33", "mode34", "mode35" #define engineConfiguration_offset 0 #define engineConfiguration_offset_hex 0 @@ -1233,8 +1233,10 @@ #define cj125SpiDevice_offset_hex 9b0 #define cj125CsPinMode_offset 2484 #define cj125CsPinMode_offset_hex 9b4 -#define unusedauxPid_offset 2488 -#define unusedauxPid_offset_hex 9b8 +#define narrowToWideOxygenBins_offset 2488 +#define narrowToWideOxygenBins_offset_hex 9b8 +#define narrowToWideOxygen_offset 2520 +#define narrowToWideOxygen_offset_hex 9d8 #define vvtMode_offset 2552 #define vvtMode_offset_hex 9f8 #define biQuad_offset 2556 diff --git a/firmware/controllers/sensors/ego.cpp b/firmware/controllers/sensors/ego.cpp index 724fcd4da2..0c98ee857d 100644 --- a/firmware/controllers/sensors/ego.cpp +++ b/firmware/controllers/sensors/ego.cpp @@ -17,6 +17,10 @@ float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) { float volts = getVoltageDivided("ego", sensor->hwChannel); + if (boardConfiguration->afr_type == ES_NarrowBand) { + return interpolate2d("narrow", volts, engineConfiguration->narrowToWideOxygenBins, engineConfiguration->narrowToWideOxygen, NARROW_BAND_WIDE_BAND_CONVERSION_SIZE); + } + return interpolate(sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts) + engineConfiguration->egoValueShift; } diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 59708db981..fe0ff6eb77 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -573,7 +573,7 @@ custom fsio_setting_t 4 scalar, F32, @OFFSET@, "Val", 1, 0, 0, custom sensor_chart_e 4 bits, S32, @OFFSET@, [0:2], @@sensor_chart_e_enum@@ sensor_chart_e sensorChartMode;+rusEfi console Sensor Sniffer mode -#define ego_sensor_e_enum "BPSX", "Innovate", "14Point7", "Narrow", "PLX" +#define ego_sensor_e_enum "BPSX", "Innovate", "14Point7", "Narrow", "PLX", "Custom" custom ego_sensor_e 4 bits, S32, @OFFSET@, [0:2], @@ego_sensor_e_enum@@ maf_sensor_type_e mafSensorType; @@ -782,7 +782,8 @@ float[MAP_ACCEL_TAPER] mapAccelTaperMult;;"mult", 1, 0, 0.0, 300, mass_storage_e storageMode; spi_device_e cj125SpiDevice; pin_output_mode_e cj125CsPinMode; - float[16] unusedauxPid; + float[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE] narrowToWideOxygenBins;Narrow Band WBO Approximation;"V", 1, 0, -10.0, 10.0, 1 + float[NARROW_BAND_WIDE_BAND_CONVERSION_SIZE] narrowToWideOxygen;;"ratio", 1, 0, -40.0, 40.0, 0 vvt_mode_e vvtMode;set vvt_mode X bi_quard_s biQuad; float[CLT_TIMING_CURVE_SIZE] cltTimingBins;CLT-based timing correction;"C", 1, 0, -100.0, 250.0, 1 diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 287a3d1e87..897b7f34a6 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -260,5 +260,5 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20171016; + return 20171029; } diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 5ef4ca7b6e..50b144750b 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -63,7 +63,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Oct 29 15:48:05 EDT 2017 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Oct 29 20:03:49 EDT 2017 pageSize = 16376 page = 1 @@ -267,7 +267,7 @@ page = 1 cj125CsPin = bits, U32, 880, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" fuelLevelEmptyTankVoltage = scalar, F32, 884, "V", 1, 0, 0,10, 2 fuelLevelFullTankVoltage = scalar, F32, 888, "V", 1, 0, 0,10, 2 - afr_type = bits, S32, 892, [0:2], "BPSX", "Innovate", "14Point7", "Narrow", "PLX" + afr_type = bits, S32, 892, [0:2], "BPSX", "Innovate", "14Point7", "Narrow", "PLX", "Custom" fuelClosedLoopAfrLowThreshold = scalar, F32, 896, "ratio", 1, 0, 0, 100, 1 hip9011CsPinMode = bits, U32, 900, [0:1], "default", "default inverted", "open collector", "open collector inverted" tachOutputPin = bits, U32, 904, [0:6], "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PA8", "PA9", "PA10", "PA11", "PA12", "PA13", "PA14", "PA15", "PB0", "PB1", "PB2", "PB3", "PB4", "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12", "PB13", "PB14", "PB15", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "PC6", "PC7", "PC8", "PC9", "PC10", "PC11", "PC12", "PC13", "PC14", "PC15", "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PE0", "PE1", "PE2", "PE3", "PE4", "PE5", "PE6", "PE7", "PE8", "PE9", "PE10", "PE11", "PE12", "PE13", "PE14", "PE15", "NONE", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID" @@ -635,7 +635,8 @@ page = 1 storageMode = bits, U32, 2476, [0:1], "Auto", "Always", "Never" cj125SpiDevice = bits,U32, 2480, [0:1], "Off", "SPI1", "SPI2", "SPI3" cj125CsPinMode = bits, U32, 2484, [0:1], "default", "default inverted", "open collector", "open collector inverted" -;skipping unusedauxPid offset 2488 + narrowToWideOxygenBins = array, F32, 2488, [8], "V", 1, 0, -10.0, 10.0, 1 + narrowToWideOxygen = array, F32, 2520, [8], "ratio", 1, 0, -40.0, 40.0, 0 vvtMode = bits, U32, 2552, [0:2], "First half", "Second half", "2GZ", "Miata NB2", "mode4", "mode5", "mode6", "mode7" biQuad_a0 = scalar, F32, 2556, "v", 1, 0, -1000, 1000, 9 biQuad_a1 = scalar, F32, 2560, "v", 1, 0, -1000, 1000, 9 @@ -1052,6 +1053,14 @@ fileVersion = { 20161225 } yBins = knockNoise gauge = RPMValue + curve = narrowToWideOxygenCurve, "Narrow to Wideband approximation" + columnLabel = "Voltage", "V" + xAxis = 0, 6, 10 + yAxis = 0, 28, 10 + xBins = narrowToWideOxygenBins + yBins = narrowToWideOxygen + gauge = afr1Gauge + curve = mapAccelTaper, "Engine Load Acceleration Enrichment Taper" columnLabel = "Distance", "Multiplier" xAxis = 0, 128, 10 @@ -1556,6 +1565,7 @@ gaugeCategory = Fuel Data subMenu = mapSettings, "MAP Sensor Settings" subMenu = mafDecodingCurve, "MAF Sensor Settings" subMenu = egoSettings, "EGO Sensor Settings" + subMenu = narrowToWideOxygenCurve, "Narrow to Wideband approximation" subMenu = egtInputs, "EGT inputs" subMenu = energySystems, "Battery and Alternator Settings" subMenu = auxPidDialog, "Aux PID" @@ -2066,6 +2076,8 @@ cmd_stop_engine = "w\x00\x99\x00\x00" ; Engine->EGO Sensor Settings dialog = egoSettings_sensor, "EGO Sensor Settings" + fiedl = "Type", afr_type +; todo: only use these values for custom! field = "low voltage", afr_v1 field = "low value", afr_value1 field = "high voltage", afr_v2 diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 50364275cc..5178d37a79 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -280,6 +280,14 @@ fileVersion = { 20161225 } yBins = knockNoise gauge = RPMValue + curve = narrowToWideOxygenCurve, "Narrow to Wideband approximation" + columnLabel = "Voltage", "V" + xAxis = 0, 6, 10 + yAxis = 0, 28, 10 + xBins = narrowToWideOxygenBins + yBins = narrowToWideOxygen + gauge = afr1Gauge + curve = mapAccelTaper, "Engine Load Acceleration Enrichment Taper" columnLabel = "Distance", "Multiplier" xAxis = 0, 128, 10 @@ -784,6 +792,7 @@ gaugeCategory = Fuel Data subMenu = mapSettings, "MAP Sensor Settings" subMenu = mafDecodingCurve, "MAF Sensor Settings" subMenu = egoSettings, "EGO Sensor Settings" + subMenu = narrowToWideOxygenCurve, "Narrow to Wideband approximation" subMenu = egtInputs, "EGT inputs" subMenu = energySystems, "Battery and Alternator Settings" subMenu = auxPidDialog, "Aux PID" @@ -1294,6 +1303,8 @@ cmd_stop_engine = "w\x00\x99\x00\x00" ; Engine->EGO Sensor Settings dialog = egoSettings_sensor, "EGO Sensor Settings" + fiedl = "Type", afr_type +; todo: only use these values for custom! field = "low voltage", afr_v1 field = "low value", afr_value1 field = "high voltage", afr_v2 diff --git a/java_console/models/src/com/rusefi/config/Fields.java b/java_console/models/src/com/rusefi/config/Fields.java index 33495cb02d..7816331c1c 100644 --- a/java_console/models/src/com/rusefi/config/Fields.java +++ b/java_console/models/src/com/rusefi/config/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config; -// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Oct 29 15:48:05 EDT 2017 +// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Oct 29 20:03:49 EDT 2017 public class Fields { public static final int LE_COMMAND_LENGTH = 200; public static final int BLOCKING_FACTOR = 400; @@ -894,7 +894,8 @@ public class Fields { public static final int storageMode_offset = 2476; public static final int cj125SpiDevice_offset = 2480; public static final int cj125CsPinMode_offset = 2484; - public static final int unusedauxPid_offset = 2488; + public static final int narrowToWideOxygenBins_offset = 2488; + public static final int narrowToWideOxygen_offset = 2520; public static final int vvtMode_offset = 2552; public static final int biQuad_offset = 2556; public static final int biQuad_a0_offset = 2556; @@ -1319,7 +1320,7 @@ public class Fields { public static final Field CJ125CSPIN = Field.create("CJ125CSPIN", 880, FieldType.INT, brain_pin_e); public static final Field FUELLEVELEMPTYTANKVOLTAGE = Field.create("FUELLEVELEMPTYTANKVOLTAGE", 884, FieldType.FLOAT); public static final Field FUELLEVELFULLTANKVOLTAGE = Field.create("FUELLEVELFULLTANKVOLTAGE", 888, FieldType.FLOAT); - public static final String[] ego_sensor_e = {"BPSX", "Innovate", "14Point7", "Narrow", "PLX"}; + public static final String[] ego_sensor_e = {"BPSX", "Innovate", "14Point7", "Narrow", "PLX", "Custom"}; public static final Field AFR_TYPE = Field.create("AFR_TYPE", 892, FieldType.INT, ego_sensor_e); public static final Field FUELCLOSEDLOOPAFRLOWTHRESHOLD = Field.create("FUELCLOSEDLOOPAFRLOWTHRESHOLD", 896, FieldType.FLOAT); public static final Field HIP9011CSPINMODE = Field.create("HIP9011CSPINMODE", 900, FieldType.INT, pin_output_mode_e);