mirror of https://github.com/rusefi/rusefi.git
switching to target RPM curve
This commit is contained in:
parent
73024a808a
commit
3de93ad64d
|
@ -82,7 +82,7 @@ void setGy6139qmbDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE)
|
||||||
|
|
||||||
engineConfiguration->rpmHardLimit = 9000;
|
engineConfiguration->rpmHardLimit = 9000;
|
||||||
engineConfiguration->cranking.rpm = 1100;
|
engineConfiguration->cranking.rpm = 1100;
|
||||||
engineConfiguration->targetIdleRpm = 2000;
|
setTargetRpmCurve(2000 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
engineConfiguration->analogInputDividerCoefficient = 1;
|
engineConfiguration->analogInputDividerCoefficient = 1;
|
||||||
engineConfiguration->fuelAlgorithm = LM_MAP;
|
engineConfiguration->fuelAlgorithm = LM_MAP;
|
||||||
engineConfiguration->globalTriggerAngleOffset = 45;
|
engineConfiguration->globalTriggerAngleOffset = 45;
|
||||||
|
|
|
@ -347,7 +347,7 @@ void setMiata1994_s(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->acIdleRpmBump = 200;
|
engineConfiguration->acIdleRpmBump = 200;
|
||||||
|
|
||||||
//engineConfiguration->idleMode != IM_AUTO;
|
//engineConfiguration->idleMode != IM_AUTO;
|
||||||
engineConfiguration->targetIdleRpm = 800;
|
setTargetRpmCurve(800 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
|
||||||
engineConfiguration->tpsMax = 86;
|
engineConfiguration->tpsMax = 86;
|
||||||
|
|
|
@ -188,8 +188,8 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
void setConstantDwell(floatms_t dwellMs DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void setConstantDwell(floatms_t dwellMs DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
|
for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
|
||||||
engineConfiguration->sparkDwellRpmBins[i] = 1000 * i;
|
engineConfiguration->sparkDwellRpmBins[i] = 1000 * i;
|
||||||
engineConfiguration->sparkDwellValues[i] = dwellMs;
|
|
||||||
}
|
}
|
||||||
|
setTableBin2(engineConfiguration->sparkDwellValues, DWELL_CURVE_SIZE, dwellMs, dwellMs, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAfrMap(afr_table_t table, float value) {
|
void setAfrMap(afr_table_t table, float value) {
|
||||||
|
@ -556,6 +556,11 @@ static void setCanDefaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
|
engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setTargetRpmCurve(int rpm PASS_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
setTableBin2(engineConfiguration->cltIdleRpmBins, DWELL_CURVE_SIZE, -40, 90, 0);
|
||||||
|
setTableBin2(engineConfiguration->cltIdleRpm, DWELL_CURVE_SIZE, rpm, rpm, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Global default engine configuration
|
* @brief Global default engine configuration
|
||||||
* This method sets the global engine configuration defaults. These default values are then
|
* This method sets the global engine configuration defaults. These default values are then
|
||||||
|
@ -841,7 +846,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// set idle_position 50
|
// set idle_position 50
|
||||||
boardConfiguration->manIdlePosition = 50;
|
boardConfiguration->manIdlePosition = 50;
|
||||||
engineConfiguration->crankingIACposition = 50;
|
engineConfiguration->crankingIACposition = 50;
|
||||||
engineConfiguration->targetIdleRpm = 1200;
|
setTargetRpmCurve(1200 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
// engineConfiguration->idleMode = IM_AUTO;
|
// engineConfiguration->idleMode = IM_AUTO;
|
||||||
engineConfiguration->idleMode = IM_MANUAL;
|
engineConfiguration->idleMode = IM_MANUAL;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ typedef struct {
|
||||||
|
|
||||||
void prepareVoidConfiguration(engine_configuration_s *activeConfiguration);
|
void prepareVoidConfiguration(engine_configuration_s *activeConfiguration);
|
||||||
void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
void setTargetRpmCurve(int rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
void setAfrMap(afr_table_t table, float value);
|
void setAfrMap(afr_table_t table, float value);
|
||||||
void setMap(fuel_table_t table, float value);
|
void setMap(fuel_table_t table, float value);
|
||||||
void setWholeFuelMap(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void setWholeFuelMap(float value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Dec 11 11:22:10 EST 2017
|
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Dec 24 21:42:02 EST 2017
|
||||||
// begin
|
// begin
|
||||||
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
|
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
|
||||||
#define ENGINE_CONFIGURATION_GENERATED_H_
|
#define ENGINE_CONFIGURATION_GENERATED_H_
|
||||||
|
@ -1357,7 +1357,7 @@ typedef struct {
|
||||||
* See also cltIdleCorr
|
* See also cltIdleCorr
|
||||||
* offset 1492
|
* offset 1492
|
||||||
*/
|
*/
|
||||||
int targetIdleRpm;
|
int unusedIdleRpm;
|
||||||
/**
|
/**
|
||||||
* A/C button input handled as analog input
|
* A/C button input handled as analog input
|
||||||
* offset 1496
|
* offset 1496
|
||||||
|
@ -2233,4 +2233,4 @@ typedef struct {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Mon Dec 11 11:22:10 EST 2017
|
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Dec 24 21:42:02 EST 2017
|
||||||
|
|
|
@ -918,8 +918,8 @@
|
||||||
#define twoWireBatchIgnition_offset_hex 5cc
|
#define twoWireBatchIgnition_offset_hex 5cc
|
||||||
#define engineChartSize_offset 1488
|
#define engineChartSize_offset 1488
|
||||||
#define engineChartSize_offset_hex 5d0
|
#define engineChartSize_offset_hex 5d0
|
||||||
#define targetIdleRpm_offset 1492
|
#define unusedIdleRpm_offset 1492
|
||||||
#define targetIdleRpm_offset_hex 5d4
|
#define unusedIdleRpm_offset_hex 5d4
|
||||||
#define acSwitchAdc_offset 1496
|
#define acSwitchAdc_offset 1496
|
||||||
#define acSwitchAdc_offset_hex 5d8
|
#define acSwitchAdc_offset_hex 5d8
|
||||||
#define ignMathCalculateAtIndex_offset 1500
|
#define ignMathCalculateAtIndex_offset 1500
|
||||||
|
|
|
@ -52,8 +52,6 @@ static SimplePwm idleSolenoid;
|
||||||
|
|
||||||
static StepperMotor iacMotor;
|
static StepperMotor iacMotor;
|
||||||
|
|
||||||
static int adjustedTargetRpm;
|
|
||||||
|
|
||||||
static uint32_t lastCrankingCyclesCounter = 0;
|
static uint32_t lastCrankingCyclesCounter = 0;
|
||||||
static float lastCrankingIacPosition;
|
static float lastCrankingIacPosition;
|
||||||
|
|
||||||
|
@ -162,9 +160,17 @@ static float autoIdle(float cltCorrection) {
|
||||||
return currentIdlePosition;
|
return currentIdlePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustedTargetRpm = engineConfiguration->targetIdleRpm * cltCorrection;
|
// get Target RPM for Auto-PID from a separate table
|
||||||
|
float clt = engine->sensors.clt;
|
||||||
|
int targetRpm;
|
||||||
|
if (cisnan(clt)) {
|
||||||
|
// error is already reported, let's take first value from the table should be good enough error handing solution
|
||||||
|
targetRpm = CONFIG(cltIdleRpm)[0];
|
||||||
|
} else {
|
||||||
|
targetRpm = interpolate2d("cltRpm", clt, CONFIG(cltIdleRpmBins), CONFIG(cltIdleRpm), CLT_CURVE_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
percent_t newValue = idlePid.getValue(adjustedTargetRpm, getRpmE(engine), engineConfiguration->idleRpmPid.period);
|
percent_t newValue = idlePid.getValue(targetRpm, getRpmE(engine), engineConfiguration->idleRpmPid.period);
|
||||||
|
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +274,7 @@ static msg_t ivThread(int param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTargetIdleRpm(int value) {
|
void setTargetIdleRpm(int value) {
|
||||||
engineConfiguration->targetIdleRpm = value;
|
setTargetRpmCurve(value PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
scheduleMsg(logger, "target idle RPM %d", value);
|
scheduleMsg(logger, "target idle RPM %d", value);
|
||||||
showIdleInfo();
|
showIdleInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -667,7 +667,7 @@ custom idle_mode_e 4 bits, U32, @OFFSET@, [0:0], "false", "true"
|
||||||
uint32_t engineChartSize;;"count", 1, 0, 0, 300, 0
|
uint32_t engineChartSize;;"count", 1, 0, 0, 300, 0
|
||||||
|
|
||||||
|
|
||||||
int targetIdleRpm;set idle_rpm X\nSee also cltIdleCorr;"RPM", 1, 0, 0, 7000, 0
|
int unusedIdleRpm;set idle_rpm X\nSee also cltIdleCorr;"RPM", 1, 0, 0, 7000, 0
|
||||||
|
|
||||||
adc_channel_e acSwitchAdc;A/C button input handled as analog input
|
adc_channel_e acSwitchAdc;A/C button input handled as analog input
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
; see PAGE_0_SIZE in C source code
|
; see PAGE_0_SIZE in C source code
|
||||||
; CONFIG_DEFINITION_START
|
; CONFIG_DEFINITION_START
|
||||||
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Dec 23 11:13:57 EST 2017
|
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Dec 24 21:42:02 EST 2017
|
||||||
|
|
||||||
pageSize = 20000
|
pageSize = 20000
|
||||||
page = 1
|
page = 1
|
||||||
|
@ -478,7 +478,7 @@ page = 1
|
||||||
useOnlyRisingEdgeForTrigger= bits, U32, 1484, [14:14], "false", "true"
|
useOnlyRisingEdgeForTrigger= bits, U32, 1484, [14:14], "false", "true"
|
||||||
twoWireBatchIgnition = bits, U32, 1484, [15:15], "false", "true"
|
twoWireBatchIgnition = bits, U32, 1484, [15:15], "false", "true"
|
||||||
engineChartSize = scalar, U32, 1488, "count", 1, 0, 0, 300, 0
|
engineChartSize = scalar, U32, 1488, "count", 1, 0, 0, 300, 0
|
||||||
targetIdleRpm = scalar, S32, 1492, "RPM", 1, 0, 0, 7000, 0
|
unusedIdleRpm = scalar, S32, 1492, "RPM", 1, 0, 0, 7000, 0
|
||||||
acSwitchAdc = bits, U32, 1496, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
acSwitchAdc = bits, U32, 1496, [0:4] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5", "Disabled", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||||
ignMathCalculateAtIndex = scalar, S32, 1500, "index", 1, 0, 0, 7000, 0
|
ignMathCalculateAtIndex = scalar, S32, 1500, "index", 1, 0, 0, 7000, 0
|
||||||
;skipping acCutoffLowRpm offset 1504
|
;skipping acCutoffLowRpm offset 1504
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.config;
|
package com.rusefi.config;
|
||||||
|
|
||||||
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Dec 17 12:47:08 EST 2017
|
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sun Dec 24 21:42:02 EST 2017
|
||||||
public class Fields {
|
public class Fields {
|
||||||
public static final int LE_COMMAND_LENGTH = 200;
|
public static final int LE_COMMAND_LENGTH = 200;
|
||||||
public static final int BLOCKING_FACTOR = 400;
|
public static final int BLOCKING_FACTOR = 400;
|
||||||
|
@ -628,7 +628,7 @@ public class Fields {
|
||||||
public static final int useOnlyRisingEdgeForTrigger_offset = 1484;
|
public static final int useOnlyRisingEdgeForTrigger_offset = 1484;
|
||||||
public static final int twoWireBatchIgnition_offset = 1484;
|
public static final int twoWireBatchIgnition_offset = 1484;
|
||||||
public static final int engineChartSize_offset = 1488;
|
public static final int engineChartSize_offset = 1488;
|
||||||
public static final int targetIdleRpm_offset = 1492;
|
public static final int unusedIdleRpm_offset = 1492;
|
||||||
public static final int acSwitchAdc_offset = 1496;
|
public static final int acSwitchAdc_offset = 1496;
|
||||||
public static final int ignMathCalculateAtIndex_offset = 1500;
|
public static final int ignMathCalculateAtIndex_offset = 1500;
|
||||||
public static final int acCutoffLowRpm_offset = 1504;
|
public static final int acCutoffLowRpm_offset = 1504;
|
||||||
|
@ -1533,7 +1533,7 @@ public class Fields {
|
||||||
public static final Field USEONLYRISINGEDGEFORTRIGGER = Field.create("USEONLYRISINGEDGEFORTRIGGER", 1484, FieldType.BIT, 14);
|
public static final Field USEONLYRISINGEDGEFORTRIGGER = Field.create("USEONLYRISINGEDGEFORTRIGGER", 1484, FieldType.BIT, 14);
|
||||||
public static final Field TWOWIREBATCHIGNITION = Field.create("TWOWIREBATCHIGNITION", 1484, FieldType.BIT, 15);
|
public static final Field TWOWIREBATCHIGNITION = Field.create("TWOWIREBATCHIGNITION", 1484, FieldType.BIT, 15);
|
||||||
public static final Field ENGINECHARTSIZE = Field.create("ENGINECHARTSIZE", 1488, FieldType.INT);
|
public static final Field ENGINECHARTSIZE = Field.create("ENGINECHARTSIZE", 1488, FieldType.INT);
|
||||||
public static final Field TARGETIDLERPM = Field.create("TARGETIDLERPM", 1492, FieldType.INT);
|
public static final Field UNUSEDIDLERPM = Field.create("UNUSEDIDLERPM", 1492, FieldType.INT);
|
||||||
public static final Field ACSWITCHADC = Field.create("ACSWITCHADC", 1496, FieldType.INT, adc_channel_e);
|
public static final Field ACSWITCHADC = Field.create("ACSWITCHADC", 1496, FieldType.INT, adc_channel_e);
|
||||||
public static final Field IGNMATHCALCULATEATINDEX = Field.create("IGNMATHCALCULATEATINDEX", 1500, FieldType.INT);
|
public static final Field IGNMATHCALCULATEATINDEX = Field.create("IGNMATHCALCULATEATINDEX", 1500, FieldType.INT);
|
||||||
public static final Field ACCUTOFFLOWRPM = Field.create("ACCUTOFFLOWRPM", 1504, FieldType.INT);
|
public static final Field ACCUTOFFLOWRPM = Field.create("ACCUTOFFLOWRPM", 1504, FieldType.INT);
|
||||||
|
|
Loading…
Reference in New Issue