From b9338b4047cd2858631cc38ff7f118906bd0c1d3 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 21 Dec 2019 15:02:17 -0500 Subject: [PATCH] Revert "reducing magic constants" This reverts commit 032d8240 --- .../controllers/algo/rusefi_generated.h | 2 -- .../controllers/generated/rusefi_generated.h | 2 -- firmware/integration/rusefi_config.txt | 3 --- firmware/tunerstudio/rusefi.input | 20 +++++++++---------- .../com/rusefi/config/generated/Fields.java | 4 +--- .../models/src/com/rusefi/core/Sensor.java | 20 +++++++++---------- 6 files changed, 21 insertions(+), 30 deletions(-) diff --git a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h index db417c176f..395355382b 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h +++ b/firmware/config/boards/kinetis/config/controllers/algo/rusefi_generated.h @@ -1408,8 +1408,6 @@ #define mafDecodingBins_offset_hex 2e20 #define mafSensorType_offset 948 #define mafSensorType_offset_hex 3b4 -#define MAGIC_300_PACKING_MULT 300 -#define MAGIC_30_PACKING_MULT 30 #define mainRelayPin_offset 706 #define mainRelayPin_offset_hex 2c2 #define mainRelayPinMode_offset 752 diff --git a/firmware/controllers/generated/rusefi_generated.h b/firmware/controllers/generated/rusefi_generated.h index 33bf7951c1..4a0dcdf330 100644 --- a/firmware/controllers/generated/rusefi_generated.h +++ b/firmware/controllers/generated/rusefi_generated.h @@ -1408,8 +1408,6 @@ #define mafDecodingBins_offset_hex 2e20 #define mafSensorType_offset 948 #define mafSensorType_offset_hex 3b4 -#define MAGIC_300_PACKING_MULT 300 -#define MAGIC_30_PACKING_MULT 30 #define mainRelayPin_offset 706 #define mainRelayPin_offset_hex 2c2 #define mainRelayPinMode_offset 752 diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index ad3a66ea47..30b7b23428 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -128,9 +128,6 @@ struct_no_prefix engine_configuration_s #define RPM_1_BYTE_PACKING_MULT 50 #define VOLTAGE_1_BYTE_PACKING_DIV 0.02 -#define MAGIC_30_PACKING_MULT 30 -#define MAGIC_300_PACKING_MULT 300 - #define FSIO_TABLE_8 8 #define FSIO_CURVE_8 8 diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index b1e8659def..9b9b736bf3 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -225,14 +225,14 @@ fileVersion = { 20190701 } ; air flow/mass measurments MAFValue = scalar, U16, 26, "V",0.001, 0 massAirFlowValue= scalar, U16, 28, "Kg/h", 0.01, 0 - MAPValue = scalar, U16, 30, "kPa",{1/@@MAGIC_30_PACKING_MULT@@}, 0.0 - baroPressure = scalar, U16, 32, "kPa",{1/@@MAGIC_30_PACKING_MULT@@}, 0.0 + MAPValue = scalar, U16, 30, "kPa",{1/30}, 0.0 + baroPressure = scalar, U16, 32, "kPa",{1/30}, 0.0 AFRValue = scalar, U16, 34, "AFR",0.001, 0.0 engineLoad = scalar, U16, 36, "%", 0.01, 0.0 ; Blend of MAP and TPS, depends on algorithm ; misc sensors VBatt = scalar, U16, 38, "V",0.001, 0.0 - oilPressure = scalar, U16, 40, "kPa",{1/@@MAGIC_30_PACKING_MULT@@}, 0.0 + oilPressure = scalar, U16, 40, "kPa",{1/30}, 0.0 vvtPosition = scalar, U16, 42, "deg", 0.02, 0 ; 10 bit TPS ADC value (from 0 to 1023 in 5v scale) @@ -240,25 +240,25 @@ fileVersion = { 20190701 } ; fuel math chargeAirMass = scalar, U16, 44, "g",0.001, 0 - crankingFuelMs = scalar, U16, 46, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0.0 + crankingFuelMs = scalar, U16, 46, "ms",{1/300}, 0.0 currentTargetAfr= scalar, U16, 48, "ratio",0.001, 0 - baseFuel = scalar, U16, 50, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0 - fuelRunning = scalar, U16, 52, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0 - actualLastInjection=scalar,U16, 54, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0.0 + baseFuel = scalar, U16, 50, "ms",{1/300}, 0 + fuelRunning = scalar, U16, 52, "ms",{1/300}, 0 + actualLastInjection=scalar,U16, 54, "ms",{1/300}, 0.0 injectorDutyCycle=scalar, U08, 56, "%", 0.5, 0 veValue = scalar, U08, 57, "ratio", 0.5, 0 injectionOffset = scalar, S16, 58, "deg", 0.02, 0 tCharge = scalar, U16, 60, "deg C", 0.01, 0.0 ; Corrections - injectorLagMs = scalar, U16, 62, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0.0 + injectorLagMs = scalar, U16, 62, "ms",{1/300}, 0.0 iatCorrection = scalar, U16, 64, "%", 0.01, 0 cltCorrection = scalar, U16, 66, "%", 0.01, 0 baroCorrection = scalar, U16, 68, "%", 0.01, 0 - fuelPidCorrection=scalar, S16, 70, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0 + fuelPidCorrection=scalar, S16, 70, "ms",{1/300}, 0 ; Wall model AE - wallFuelAmount = scalar, U16, 72, "ms",{1/@@MAGIC_300_PACKING_MULT@@}, 0 + wallFuelAmount = scalar, U16, 72, "ms",{1/300}, 0 wallFuelCorrection=scalar, S16, 74, "ms",0.001, 0 ; TPS/load AE 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 9a453f992b..9cb4fe0767 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 Sat Dec 21 13:27:26 EST 2019 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Dec 21 12:07:30 EST 2019 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -928,8 +928,6 @@ public class Fields { public static final int mafDecoding_offset = 10784; public static final int mafDecodingBins_offset = 11808; public static final int mafSensorType_offset = 948; - public static final int MAGIC_300_PACKING_MULT = 300; - public static final int MAGIC_30_PACKING_MULT = 30; public static final int mainRelayPin_offset = 706; public static final int mainRelayPinMode_offset = 752; public static final int mainUnusedEnd_offset = 4140; diff --git a/java_console/models/src/com/rusefi/core/Sensor.java b/java_console/models/src/com/rusefi/core/Sensor.java index 5a46bf422c..46d504fbf6 100644 --- a/java_console/models/src/com/rusefi/core/Sensor.java +++ b/java_console/models/src/com/rusefi/core/Sensor.java @@ -37,7 +37,7 @@ public enum Sensor { // air flow/mass measurement MAF("MAF", SensorCategory.SENSOR_INPUTS, FieldType.UINT16, 26, 0.001, BackgroundColor.MUD, 0, 5, "Volts"), - MAP("MAP", SensorCategory.SENSOR_INPUTS, FieldType.UINT16, 28, 1.0 / MAGIC_30_PACKING_MULT, BackgroundColor.MUD, 20, 300, "kPa"), + MAP("MAP", SensorCategory.SENSOR_INPUTS, FieldType.UINT16, 28, 1.0 / 30, BackgroundColor.MUD, 20, 300, "kPa"), AFR("A/F ratio", SensorCategory.SENSOR_INPUTS, FieldType.UINT16, /*offset */ 34, 0.001, BackgroundColor.MUD, 10, 20, "afr"), @@ -46,33 +46,33 @@ public enum Sensor { // fuel math CHARGE_AIR_MASS("airmass", SensorCategory.OPERATIONS, FieldType.UINT16, 44, 0.001, BackgroundColor.MUD, 0, 3, "g/cyl"), - crankingFuel(GAUGE_NAME_FUEL_CRANKING, SensorCategory.FUEL, FieldType.UINT16, 46, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 30, "ms"), + crankingFuel(GAUGE_NAME_FUEL_CRANKING, SensorCategory.FUEL, FieldType.UINT16, 46, 1.0 / 300, BackgroundColor.MUD, 0, 30, "ms"), TARGET_AFR("A/F target", SensorCategory.OPERATIONS, FieldType.INT16, 48, 0.001, BackgroundColor.MUD, 10, 20, "afr"), - baseFuel(Fields.GAUGE_NAME_FUEL_BASE, SensorCategory.FUEL, FieldType.UINT16, 50, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 30, "ms"), - runningFuel(GAUGE_NAME_FUEL_RUNNING, SensorCategory.FUEL, FieldType.UINT16, 52, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 15, "ms"), - actualLastInjection(GAUGE_NAME_FUEL_LAST_INJECTION, SensorCategory.FUEL, FieldType.UINT16, /*offset */ 54, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 30, "ms"), + baseFuel(Fields.GAUGE_NAME_FUEL_BASE, SensorCategory.FUEL, FieldType.UINT16, 50, 1.0 / 300, BackgroundColor.MUD, 0, 30, "ms"), + runningFuel(GAUGE_NAME_FUEL_RUNNING, SensorCategory.FUEL, FieldType.UINT16, 52, 1.0 / 300, BackgroundColor.MUD, 0, 15, "ms"), + actualLastInjection(GAUGE_NAME_FUEL_LAST_INJECTION, SensorCategory.FUEL, FieldType.UINT16, /*offset */ 54, 1.0 / 300, BackgroundColor.MUD, 0, 30, "ms"), injectorDutyCycle(Fields.GAUGE_NAME_FUEL_INJ_DUTY, SensorCategory.FUEL, FieldType.UINT8, 56, 0.5, BackgroundColor.MUD, 0, 100, "%"), veValue(GAUGE_NAME_FUEL_VE, SensorCategory.FUEL, FieldType.FLOAT, 57, 0.5, BackgroundColor.MUD, 0, 100, "%"), tCharge(GAUGE_NAME_TCHARGE, SensorCategory.FUEL, FieldType.FLOAT, 60, 0.01, BackgroundColor.MUD, 30, 140, "C"), // Corrections - injectorLagMs(GAUGE_NAME_INJECTOR_LAG, SensorCategory.FUEL, FieldType.UINT16, 62, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 15, "ms"), + injectorLagMs(GAUGE_NAME_INJECTOR_LAG, SensorCategory.FUEL, FieldType.UINT16, 62, 1.0 / 300, BackgroundColor.MUD, 0, 15, "ms"), iatCorrection(GAUGE_NAME_FUEL_IAT_CORR, SensorCategory.FUEL, FieldType.INT16, 64, 0.01, BackgroundColor.MUD, 0, 5, "ratio"), cltCorrection(GAUGE_NAME_FUEL_CLT_CORR, SensorCategory.FUEL, FieldType.INT16, 66, 0.01, BackgroundColor.MUD, 0, 5, "ratio"), - fuelPidCorrection("Fuel PID", SensorCategory.FUEL, FieldType.INT16, 70, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, -2, 2, "ms"), + fuelPidCorrection("Fuel PID", SensorCategory.FUEL, FieldType.INT16, 70, 1.0 / 300, BackgroundColor.MUD, -2, 2, "ms"), // Wall model AE - wallFuelAmount(GAUGE_NAME_FUEL_WALL_AMOUNT, SensorCategory.FUEL, FieldType.UINT16, 72, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 20, "ms"), + wallFuelAmount(GAUGE_NAME_FUEL_WALL_AMOUNT, SensorCategory.FUEL, FieldType.UINT16, 72, 1.0 / 300, BackgroundColor.MUD, 0, 20, "ms"), wallFuelCorrection(GAUGE_NAME_FUEL_WALL_CORRECTION, SensorCategory.FUEL, FieldType.INT16, 74, 0.001, BackgroundColor.MUD, -5, 5, "ms"), // TPS/load AE engineLoadAccelDelta("load accel delta", SensorCategory.FUEL, FieldType.INT16, 76, 0.01, BackgroundColor.MUD, -5, 5, "ratio"), deltaTps(Fields.GAUGE_NAME_FUEL_TPS_ROC, SensorCategory.FUEL, FieldType.INT16, 78, 0.01, BackgroundColor.MUD, -100, 100, "%"), - tpsAccelFuel(Fields.GAUGE_NAME_FUEL_TPS_EXTRA, SensorCategory.FUEL, FieldType.INT16, 82, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 0, 200, "ms"), + tpsAccelFuel(Fields.GAUGE_NAME_FUEL_TPS_EXTRA, SensorCategory.FUEL, FieldType.INT16, 82, 1.0 / 300, BackgroundColor.MUD, 0, 200, "ms"), // Ignition ignitionAdvance("ignition timing", SensorCategory.OPERATIONS, FieldType.INT16, 84, 0.02, BackgroundColor.MUD, 30, 140, "deg"), - DWELL(Fields.GAUGE_COIL_DWELL_TIME, SensorCategory.OPERATIONS, FieldType.UINT16, 86, 1.0 / MAGIC_300_PACKING_MULT, BackgroundColor.MUD, 1, 10, "ms"), + DWELL(Fields.GAUGE_COIL_DWELL_TIME, SensorCategory.OPERATIONS, FieldType.UINT16, 86, 1.0 / 300, BackgroundColor.MUD, 1, 10, "ms"), coilDutyCycle(Fields.GAUGE_NAME_DWELL_DUTY, SensorCategory.OPERATIONS, FieldType.UINT16, 88, 0.01, BackgroundColor.MUD, 0, 100, "%"), // Idle & ETB