auto-sync

This commit is contained in:
rusEfi 2015-10-19 22:02:51 -04:00
parent 3bf220cd38
commit 26a1128695
12 changed files with 137 additions and 29 deletions

View File

@ -118,7 +118,7 @@ AccelEnrichmemnt::AccelEnrichmemnt() {
static void accelInfo() {
// scheduleMsg(logger, "MAP accel length=%d", mapInstance.cb.getSize());
scheduleMsg(logger, "MAP accel th=%f/mult=%f", engineConfiguration->mapAccelEnrichmentThreshold, engineConfiguration->mapAccelEnrichmentMultiplier);
scheduleMsg(logger, "MAP decel th=%f/mult=%f", engineConfiguration->decelEnrichmentThreshold, engineConfiguration->decelEnrichmentMultiplier);
scheduleMsg(logger, "MAP decel th=%f/mult=%f", engineConfiguration->decelEnleanmentThreshold, engineConfiguration->decelEnleanmentMultiplier);
// scheduleMsg(logger, "TPS accel length=%d", tpsInstance.cb.getSize());
scheduleMsg(logger, "TPS accel th=%f/mult=%f", engineConfiguration->tpsAccelEnrichmentThreshold, engineConfiguration->tpsAccelEnrichmentMultiplier);
@ -147,12 +147,12 @@ static void setTpsAccelMult(float value) {
}
static void setDecelThr(float value) {
engineConfiguration->decelEnrichmentThreshold = value;
engineConfiguration->decelEnleanmentThreshold = value;
accelInfo();
}
static void setDecelMult(float value) {
engineConfiguration->decelEnrichmentMultiplier = value;
engineConfiguration->decelEnleanmentMultiplier = value;
accelInfo();
}

View File

@ -264,6 +264,17 @@ case IM_MANUAL:
}
return NULL;
}
const char *getIdle_control_e(idle_control_e value){
switch(value) {
case Force_4b_idle_control:
return "Force_4b_idle_control";
case IC_PID:
return "IC_PID";
case IC_LINEAR:
return "IC_LINEAR";
}
return NULL;
}
const char *getPin_output_mode_e(pin_output_mode_e value){
switch(value) {
case Force_4b_pin_output_mode:

View File

@ -20,6 +20,7 @@ const char *getDisplay_mode_e(display_mode_e value);
const char *getLog_format_e(log_format_e value);
const char *getIdle_mode_e(idle_mode_e value);
const char *getPin_output_mode_e(pin_output_mode_e value);
const char *getIdle_control_e(idle_control_e value);
const char *getGpio_mode_e(gpio_mode_e value);
const char *getPin_input_mode_e(pin_input_mode_e value);
const char *getFiring_order_e(firing_order_e value);

View File

@ -31,6 +31,7 @@
#include "advance_map.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "electronic_throttle.h"
#include "idle_thread.h"
#include "alternatorController.h"
#endif
@ -189,7 +190,9 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__)
setDefaultEtbParameters();
#endif
#if EFI_IDLE_CONTROL || defined(__DOXYGEN__)
setDefaultIdleParameters();
#endif
boardConfiguration->wboHeaterPin = GPIO_UNASSIGNED;
boardConfiguration->wboPumpPin = GPIO_UNASSIGNED;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Sun Oct 18 19:32:33 EDT 2015
// this section was generated by config_definition.jar on Mon Oct 19 21:36:30 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -1307,7 +1307,27 @@ typedef struct {
/**
* offset 1908
*/
int unused3[62];
float idlePFactor;
/**
* offset 1912
*/
float idleIFactor;
/**
* offset 1916
*/
float idleDFactor;
/**
* offset 1920
*/
int idleDT;
/**
* offset 1924
*/
idle_control_e idleControl;
/**
* offset 1928
*/
int unused3[57];
/**
* offset 2156
*/
@ -1358,11 +1378,11 @@ typedef struct {
/**
* offset 2200
*/
float decelEnrichmentThreshold;
float decelEnleanmentThreshold;
/**
* offset 2204
*/
float decelEnrichmentMultiplier;
float decelEnleanmentMultiplier;
/**
* offset 2208
*/
@ -1518,4 +1538,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Sun Oct 18 19:32:33 EDT 2015
// this section was generated by config_definition.jar on Mon Oct 19 21:36:30 EDT 2015

View File

@ -240,6 +240,12 @@ typedef enum {
IM_AUTO = 0, IM_MANUAL = 1, Force_4b_idle_mode = ENUM_32_BITS,
} idle_mode_e;
typedef enum {
IC_LINEAR = 0,
IC_PID = 1,
Force_4b_idle_control = ENUM_32_BITS,
} idle_control_e;
typedef enum {
/**
* GND for logical OFF, VCC for logical ON

View File

@ -670,8 +670,17 @@
#define mapErrorHighValue_offset 1900
#define step1RpmWindow_offset 1904
#define step1RpmWindow_offset_hex 770
#define unused3_offset 1908
#define unused3_offset_hex 774
#define idlePFactor_offset 1908
#define idlePFactor_offset_hex 774
#define idleIFactor_offset 1912
#define idleIFactor_offset_hex 778
#define idleDFactor_offset 1916
#define idleDT_offset 1920
#define idleDT_offset_hex 780
#define idleControl_offset 1924
#define idleControl_offset_hex 784
#define unused3_offset 1928
#define unused3_offset_hex 788
#define targetVBatt_offset 2156
#define alternatorOffAboveTps_offset 2160
#define alternatorOffAboveTps_offset_hex 870
@ -691,9 +700,9 @@
#define tpsAccelEnrichmentMultiplier_offset_hex 890
#define mapAccelLength_offset 2196
#define mapAccelLength_offset_hex 894
#define decelEnrichmentThreshold_offset 2200
#define decelEnrichmentThreshold_offset_hex 898
#define decelEnrichmentMultiplier_offset 2204
#define decelEnleanmentThreshold_offset 2200
#define decelEnleanmentThreshold_offset_hex 898
#define decelEnleanmentMultiplier_offset 2204
#define mapAccelEnrichmentThreshold_offset 2208
#define mapAccelEnrichmentMultiplier_offset 2212
#define le_formulas1_offset 2216

View File

@ -73,6 +73,11 @@ static void showIdleInfo(void) {
scheduleMsg(logger, "idle valve freq=%d on %s", boardConfiguration->idle.solenoidFrequency,
hwPortname(boardConfiguration->idle.solenoidPin));
}
scheduleMsg(logger, "idleControl=%s", getIdle_control_e(engineConfiguration->idleControl));
scheduleMsg(logger, "idle P=%f I=%f D=%f dT=%d", engineConfiguration->idlePFactor,
engineConfiguration->idleIFactor,
engineConfiguration->idleDFactor,
engineConfiguration->idleDT);
}
static void setIdleControlEnabled(int value) {
@ -197,6 +202,40 @@ static void setIdleRpmAction(int value) {
idleMath.setTargetRpm(value);
scheduleMsg(logger, "target idle RPM %d", value);
}
static void apply(void) {
// idleMath.updateFactors(engineConfiguration->idlePFactor, engineConfiguration->idleIFactor, engineConfiguration->idleDFactor, engineConfiguration->idleDT);
}
static void setIdlePFactor(float value) {
engineConfiguration->idlePFactor = value;
apply();
showIdleInfo();
}
static void setIdleIFactor(float value) {
engineConfiguration->idleIFactor = value;
apply();
showIdleInfo();
}
static void setIdleDFactor(float value) {
engineConfiguration->idleDFactor = value;
apply();
showIdleInfo();
}
static void setIdleDT(int value) {
engineConfiguration->idleDT = value;
apply();
showIdleInfo();
}
void setDefaultIdleParameters(void) {
engineConfiguration->idlePFactor = 0.1f;
engineConfiguration->idleIFactor = 0.05f;
engineConfiguration->idleDFactor = 0.0f;
engineConfiguration->idleDT = 10;
}
static void applyIdleSolenoidPinState(PwmConfig *state, int stateIndex) {
efiAssertVoid(stateIndex < PWM_PHASE_MAX_COUNT, "invalid stateIndex");
@ -246,6 +285,13 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) {
addConsoleActionI("set_idle_enabled", (VoidInt) setIdleControlEnabled);
addConsoleActionII("blipidle", blipIdle);
addConsoleActionF("set_idle_p", setIdlePFactor);
addConsoleActionF("set_idle_i", setIdleIFactor);
addConsoleActionF("set_idle_d", setIdleDFactor);
addConsoleActionI("set_idle_dt", setIdleDT);
apply();
}
#endif

View File

@ -13,5 +13,6 @@
percent_t getIdlePosition(void);
void startIdleThread(Logging*sharedLogger, Engine *engine);
void setDefaultIdleParameters(void);
#endif /* IDLE_THREAD_H_ */

View File

@ -103,7 +103,8 @@ static void endSimultaniousInjection(Engine *engine) {
extern WallFuel wallFuel;
static ALWAYS_INLINE void handleFuelInjectionEvent(bool_t limitedFuel, InjectionEvent *event, int rpm DECLARE_ENGINE_PARAMETER_S) {
static ALWAYS_INLINE void handleFuelInjectionEvent(bool_t limitedFuel, InjectionEvent *event,
int rpm DECLARE_ENGINE_PARAMETER_S) {
/**
* todo: this is a bit tricky with batched injection. is it? Does the same
* wetting coefficient works the same way for any injection mode, or is something
@ -148,7 +149,8 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(bool_t limitedFuel, Injection
if (!limitedFuel) {
scheduleTask("out up", sUp, (int) injectionStartDelayUs, (schfunc_t) &startSimultaniousInjection, engine);
scheduleTask("out down", sDown, (int) injectionStartDelayUs + MS2US(injectionDuration), (schfunc_t) &endSimultaniousInjection, engine);
scheduleTask("out down", sDown, (int) injectionStartDelayUs + MS2US(injectionDuration),
(schfunc_t) &endSimultaniousInjection, engine);
}
} else {
@ -321,7 +323,7 @@ static ALWAYS_INLINE void ignitionMathCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
/**
* this field is used as an Expression in IAR debugger
*/
uint32_t *cyccnt = (uint32_t*)&DWT_CYCCNT;
uint32_t *cyccnt = (uint32_t*) &DWT_CYCCNT;
#endif
static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionIndex DECLARE_ENGINE_PARAMETER_S) {
@ -359,8 +361,7 @@ static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionI
list->reset(); // reset is needed to clear previous ignition schedule
return;
}
initializeIgnitionActions(engine->engineState.advance, engine->engineState.dwellAngle,
list PASS_ENGINE_PARAMETER);
initializeIgnitionActions(engine->engineState.advance, engine->engineState.dwellAngle, list PASS_ENGINE_PARAMETER);
engine->m.ignitionSchTime = GET_TIMESTAMP() - engine->m.beforeIgnitionSch;
engine->m.beforeInjectonSch = GET_TIMESTAMP();
@ -452,7 +453,8 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
/**
* For spark we schedule both start of coil charge and actual spark based on trigger angle
*/
handleSpark(limitedSpark, eventIndex, rpm, &engine->engineConfiguration2->ignitionEvents[revolutionIndex] PASS_ENGINE_PARAMETER);
handleSpark(limitedSpark, eventIndex, rpm,
&engine->engineConfiguration2->ignitionEvents[revolutionIndex] PASS_ENGINE_PARAMETER);
#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__)
int diff = hal_lld_get_counter_value() - beforeCallback;
if (diff > 0)
@ -486,8 +488,7 @@ static void showMainInfo(Engine *engine) {
int rpm = engine->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F);
float el = getEngineLoadT(PASS_ENGINE_PARAMETER_F);
scheduleMsg(logger, "rpm %d engine_load %f", rpm, el);
scheduleMsg(logger, "fuel %fms timing %f", getFuelMs(rpm PASS_ENGINE_PARAMETER),
engine->engineState.timingAdvance);
scheduleMsg(logger, "fuel %fms timing %f", getFuelMs(rpm PASS_ENGINE_PARAMETER), engine->engineState.timingAdvance);
#endif
}

View File

@ -584,7 +584,12 @@ baro_corr_table_t baroCorrTable;
float mapErrorLowValue;kPa value which is too low to be true;"kPa", 1, 0, -100.0, 100.0, 2
float mapErrorHighValue;kPa value which is too high to be true;"kPa", 1, 0, -100.0, 800.0, 2
int step1RpmWindow;RPMs prior to step1rpm point where ignition advance is retarded;"rpm", 1, 0, 0, 3000.0, 2
int[62] unused3;
float idlePFactor;
float idleIFactor;
float idleDFactor;
int idleDT;
idle_control_e idleControl;
int[57] unused3;
float targetVBatt;;"Volts", 1, 0, 0,30, 1
float alternatorOffAboveTps;Turn off alternator output above specified TPS;"%", 1, 0, 0, 200, 2
@ -600,8 +605,8 @@ baro_corr_table_t baroCorrTable;
int mapAccelLength;;"len", 1, 0, 1, 200, 3
float decelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
float decelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3
float decelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3
float decelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3
float mapAccelEnrichmentThreshold;;"roc", 1, 0, 0, 200, 3
float mapAccelEnrichmentMultiplier;;"coeff", 1, 0, 0, 200, 3

View File

@ -40,7 +40,7 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated by ConfigDefinition.jar on Sun Oct 18 19:32:39 EDT 2015
; this section was generated by ConfigDefinition.jar on Mon Oct 19 21:36:35 EDT 2015
pageSize = 15288
page = 1
@ -478,7 +478,12 @@ page = 1
mapErrorLowValue = scalar, F32, 1896, "kPa", 1, 0, -100.0, 100.0, 2
mapErrorHighValue = scalar, F32, 1900, "kPa", 1, 0, -100.0, 800.0, 2
step1RpmWindow = scalar, S32, 1904, "rpm", 1, 0, 0, 3000.0, 2
;skipping unused3 offset 1908
;skipping idlePFactor offset 1908
;skipping idleIFactor offset 1912
;skipping idleDFactor offset 1916
;skipping idleDT offset 1920
;skipping idleControl offset 1924
;skipping unused3 offset 1928
targetVBatt = scalar, F32, 2156, "Volts", 1, 0, 0,30, 1
alternatorOffAboveTps = scalar, F32, 2160, "%", 1, 0, 0, 200, 2
alternatorDT = scalar, S32, 2164, "ms", 1, 0, 0, 3000, 0
@ -490,8 +495,8 @@ page = 1
tpsAccelEnrichmentThreshold = scalar, F32, 2188, "roc", 1, 0, 0, 200, 3
tpsAccelEnrichmentMultiplier = scalar, F32, 2192, "coeff", 1, 0, 0, 200, 3
mapAccelLength = scalar, S32, 2196, "len", 1, 0, 1, 200, 3
decelEnrichmentThreshold = scalar, F32, 2200, "roc", 1, 0, 0, 200, 3
decelEnrichmentMultiplier = scalar, F32, 2204, "coeff", 1, 0, 0, 200, 3
decelEnleanmentThreshold = scalar, F32, 2200, "roc", 1, 0, 0, 200, 3
decelEnleanmentMultiplier = scalar, F32, 2204, "coeff", 1, 0, 0, 200, 3
mapAccelEnrichmentThreshold = scalar, F32, 2208, "roc", 1, 0, 0, 200, 3
mapAccelEnrichmentMultiplier = scalar, F32, 2212, "coeff", 1, 0, 0, 200, 3
le_formulas1 = array, U08, 2216, [200],"char", 1, 0, 0.0, 3.0, 2