diff --git a/firmware/config/engines/test_engine.cpp b/firmware/config/engines/test_engine.cpp index 893da16cae..f1b8fb5d18 100644 --- a/firmware/config/engines/test_engine.cpp +++ b/firmware/config/engines/test_engine.cpp @@ -27,7 +27,7 @@ void setTestEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { // triggerConfig->customSkippedToothCount = 0; engineConfiguration->useOnlyRisingEdgeForTrigger = true; - engineConfiguration->mafAdcChannel = EFI_ADC_NONE; + engineConfiguration->mafAdcChannel = EFI_ADC_1; engineConfiguration->vbattAdcChannel = EFI_ADC_NONE; setWholeIatCorrTimingTable(0 PASS_ENGINE_PARAMETER); diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index edfc77497f..885768d17f 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 Tue Aug 23 20:59:13 EDT 2016 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Aug 27 10:09:22 EDT 2016 // begin #ifndef ENGINE_CONFIGURATION_GENERATED_H_ #define ENGINE_CONFIGURATION_GENERATED_H_ @@ -1132,6 +1132,7 @@ typedef struct { */ float maxKnockSubDeg; /** + * See hasMafSensor * offset 580 */ adc_channel_e mafAdcChannel; @@ -1198,6 +1199,7 @@ typedef struct { offset 1488 bit 13 */ bool isAlternatorControlEnabled : 1; /** + * See mafAdcChannel offset 1488 bit 14 */ bool hasMafSensor : 1; /** @@ -1927,4 +1929,4 @@ typedef struct { #endif // end -// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Tue Aug 23 20:59:13 EDT 2016 +// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Aug 27 10:09:22 EDT 2016 diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index 2a2efc70a3..cce1e456f4 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -183,8 +183,11 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_ efiAssertVoid(engine!=NULL, "engine is NULL"); - if (cisnan(engine->rpmCalculator.oneDegreeUs)) + if (cisnan(engine->rpmCalculator.oneDegreeUs)) { + // in order to have fuel schedule we need to have current RPM + // wonder if this line slows engine startup? return; + } efiAssertVoid(!cisnan(engine->rpmCalculator.oneDegreeUs), "NAN one deg"); diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index fd330604bf..1b15961678 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -183,11 +183,11 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int eventIndex, bool limitedF } } -static ALWAYS_INLINE void handleFuel(bool limitedFuel, uint32_t eventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) { +static ALWAYS_INLINE void handleFuel(bool limitedFuel, uint32_t currentEventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) { if (!isInjectionEnabled(engineConfiguration)) return; efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3"); - efiAssertVoid(eventIndex < ENGINE(triggerShape.getLength()), "handleFuel/event index"); + efiAssertVoid(currentEventIndex < ENGINE(triggerShape.getLength()), "handleFuel/event index"); /** * Ignition events are defined by addFuelEvents() according to selected @@ -197,7 +197,7 @@ static ALWAYS_INLINE void handleFuel(bool limitedFuel, uint32_t eventIndex, int InjectionEventList *injectionEvents = &fs->injectionEvents; - if (!fs->hasEvents[eventIndex]) + if (!fs->hasEvents[currentEventIndex]) return; #if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__) @@ -211,7 +211,7 @@ static ALWAYS_INLINE void handleFuel(bool limitedFuel, uint32_t eventIndex, int for (int injEventIndex = 0; injEventIndex < injectionEvents->size; injEventIndex++) { InjectionEvent *event = &injectionEvents->elements[injEventIndex]; - if (event->injectionStart.eventIndex != eventIndex) { + if (event->injectionStart.eventIndex != currentEventIndex) { continue; } handleFuelInjectionEvent(injEventIndex, limitedFuel, event, rpm PASS_ENGINE_PARAMETER); diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 899173b560..c7cfbe29e7 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -355,7 +355,7 @@ float globalFuelCorrection;;"coef", 1, 0.0, 0, 1000.0, 2 int16_t pedalPositionMin; int16_t pedalPositionMax; float maxKnockSubDeg;maximum total number of degrees to subtract from ignition advance\nwhen knocking - adc_channel_e mafAdcChannel; + adc_channel_e mafAdcChannel;See hasMafSensor struct afr_sensor_s adc_channel_e hwChannel; @@ -573,7 +573,7 @@ bit hasMapSensor;@see isMapAveragingEnabled bit isJoystickEnabled bit isGpsEnabled bit isAlternatorControlEnabled - bit hasMafSensor + bit hasMafSensor;See mafAdcChannel bit hasTpsSensor bit cutFuelOnHardLimit bit cutSparkOnHardLimit diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index fc04ffeadf..6f31db0830 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -38,7 +38,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see EngineSnifferPanel */ public class Launcher { - public static final int CONSOLE_VERSION = 20160821; + public static final int CONSOLE_VERSION = 20160826; public static final boolean SHOW_STIMULATOR = false; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; diff --git a/java_console/ui/src/com/rusefi/ui/FormulasPane.java b/java_console/ui/src/com/rusefi/ui/FormulasPane.java index 7d187fb1b7..f5bba61372 100644 --- a/java_console/ui/src/com/rusefi/ui/FormulasPane.java +++ b/java_console/ui/src/com/rusefi/ui/FormulasPane.java @@ -87,6 +87,21 @@ public class FormulasPane { String page; if (algo == engine_load_mode_e.LM_SPEED_DENSITY) { page = getSpeedDensity(ci, acceleration); + } else if (algo == engine_load_mode_e.LM_PLAIN_MAF) { + double rpm = SensorCentral.getInstance().getValue(Sensor.RPM); + double maf = SensorCentral.getInstance().getValue(Sensor.MAF); + + String baseFuelStr = oneDecimal(Sensor.FUEL_BASE); + String baseFuel = "$Base_Fuel (ms) = lookup (" + + "(RPM = " + rpm + ", " + + "MAF = " + maf + ") = " + + baseFuelStr + "ms"; + + String actualLastInjection = oneDecimal(Sensor.actualLastInjection); + String injTime = "$Fuel (ms) = " + baseFuel + getInjecctorLag() + + " = " + actualLastInjection + "ms_per_injection$"; + + page = acceleration + injTime; } else { page = acceleration + "todo"; } @@ -147,7 +162,6 @@ public class FormulasPane { String TARGET_AFR = oneDecimal(Sensor.TARGET_AFR); String tpsStr = oneDecimal(Sensor.TPS); String chargeAirMass = String.format("%.3fgm", SensorCentral.getInstance().getValue(Sensor.CHARGE_AIR_MASS)); - String vBatt = oneDecimal(Sensor.VBATT); double displacement = ConfigField.getFloatValue(ci, Fields.DISPLACEMENT); int cylinderCount = ConfigField.getIntValue(ci, Fields.CYLINDERSCOUNT); @@ -180,12 +194,10 @@ public class FormulasPane { String tempCorrections = " * cltCorr(" + CLTcorr + ") * iatCorr(" + IATcorr + ")"; - String injectorLag = "+ ( injectorLag(VBatt = " + vBatt + ") = " + oneDecimal(Sensor.injectorLagMs) + ")"; - String actualLastInjection = oneDecimal(Sensor.actualLastInjection); String injTime = "$Fuel (ms) = " + "(Base_Fuel (" + baseFuelStr + "ms) + Tps_Accel_Corr = (" + tpsAccel + "ms))" + - tempCorrections + injectorLag + + tempCorrections + getInjecctorLag() + " = " + actualLastInjection + "ms_per_injection$"; return acceleration + @@ -195,6 +207,12 @@ public class FormulasPane { injTime + newLine; } + @NotNull + private String getInjecctorLag() { + String vBatt = oneDecimal(Sensor.VBATT); + return "+ ( injectorLag(VBatt = " + vBatt + ") = " + oneDecimal(Sensor.injectorLagMs) + ")"; + } + private String oneDecimal(Sensor sensor) { return oneDecimal(SensorCentral.getInstance().getValue(sensor)); }