auto-sync

This commit is contained in:
rusEfi 2015-04-18 21:06:05 -04:00
parent 173bfd74c4
commit f4c5c4aa3c
7 changed files with 29 additions and 9 deletions

View File

@ -65,6 +65,8 @@ void setBmwE34(DECLARE_ENGINE_PARAMETER_F) {
setConstantDwell(3 PASS_ENGINE_PARAMETER); // a bit shorter dwell
engineConfiguration->ignMathCalculateAtIndex = 14;
engineConfiguration->mapAveragingSchedulingAtIndex = 6;
// Cranking
engineConfiguration->cranking.rpm = 600;
engineConfiguration->crankingInjectionMode = IM_BATCH;

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Wed Apr 15 12:11:02 EDT 2015
// this section was generated by config_definition.jar on Sat Apr 18 18:59:21 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -1099,7 +1099,11 @@ typedef struct {
/**
* offset 1648
*/
int unused3[134];
int mapAveragingSchedulingAtIndex;
/**
* offset 1652
*/
int unused3[133];
/**
* offset 2184
*/
@ -1279,4 +1283,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Wed Apr 15 12:11:02 EDT 2015
// this section was generated by config_definition.jar on Sat Apr 18 18:59:21 EDT 2015

View File

@ -32,6 +32,7 @@
#include "interpolation.h"
#include "signal_executor.h"
#include "engine.h"
#include "engine_math.h"
#if EFI_ANALOG_CHART
#include "analog_chart.h"
@ -168,7 +169,7 @@ static void endAveraging(void *arg) {
static void mapAveragingCallback(trigger_event_e ckpEventType, uint32_t index DECLARE_ENGINE_PARAMETER_S) {
// this callback is invoked on interrupt thread
engine->m.beforeMapAveragingCb = GET_TIMESTAMP();
if (index != 0)
if (index != engineConfiguration->mapAveragingSchedulingAtIndex)
return;
int rpm = engine->rpmCalculator.rpmValue;
@ -180,17 +181,23 @@ static void mapAveragingCallback(trigger_event_e ckpEventType, uint32_t index DE
MAP_sensor_config_s * config = &engineConfiguration->map;
angle_t samplingStart = interpolate2d(rpm, config->samplingAngleBins, config->samplingAngle, MAP_ANGLE_SIZE);
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[index]);
angle_t samplingStart = interpolate2d(rpm, config->samplingAngleBins, config->samplingAngle, MAP_ANGLE_SIZE) - currentAngle;
angle_t samplingDuration = interpolate2d(rpm, config->samplingWindowBins, config->samplingWindow, MAP_WINDOW_SIZE);
if (samplingDuration <= 0) {
firmwareError("map sampling angle should be positive");
return;
}
fixAngle(samplingStart);
angle_t samplingEnd = samplingStart + samplingDuration;
fixAngle(samplingEnd);
int structIndex = getRevolutionCounter() % 2;
// todo: schedule this based on closest trigger event, same as ignition works
scheduleByAngle(rpm, &startTimer[structIndex], samplingStart, startAveraging, NULL, &engine->rpmCalculator);
scheduleByAngle(rpm, &endTimer[structIndex], samplingStart + samplingDuration, endAveraging, NULL, &engine->rpmCalculator);
scheduleByAngle(rpm, &endTimer[structIndex], samplingEnd, endAveraging, NULL, &engine->rpmCalculator);
engine->m.mapAveragingCbTime = GET_TIMESTAMP() - engine->m.beforeMapAveragingCb;
}

View File

@ -487,7 +487,10 @@ custom pin_input_mode_e 4 scalar, F32, @OFFSET@, "ms", 1, 0, 0, 200, 1
brain_pin_e stepperEnablePin;
float noAccelAfterHardLimitPeriodSecs;;"sec", 1, 0, 0, 60, 0
int[134] unused3;
int mapAveragingSchedulingAtIndex;
int[133] unused3;
int tpsAccelLength;;"len", 1, 0, 1, 200, 3
float tpsAccelEnrichmentThreshold;;"roc", 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 Wed Apr 15 12:11:03 EDT 2015
; this section was generated by ConfigDefinition.jar on Sat Apr 18 18:59:23 EDT 2015
pageSize = 15288
page = 1
@ -453,7 +453,8 @@ page = 1
idleStepperTotalSteps = scalar, S32, 1636, "count", 1, 0, 5, 3000, 0
stepperEnablePin = bits, U32, 1640, [0:6], "GPIOA_0", "GPIOA_1", "GPIOA_2", "GPIOA_3", "GPIOA_4", "GPIOA_5", "GPIOA_6", "GPIOA_7", "GPIOA_8", "GPIOA_9", "GPIOA_10", "GPIOA_11", "GPIOA_12", "GPIOA_13", "GPIOA_14", "GPIOA_15", "GPIOB_0", "GPIOB_1", "GPIOB_2", "GPIOB_3", "GPIOB_4", "GPIOB_5", "GPIOB_6", "GPIOB_7", "GPIOB_8", "GPIOB_9", "GPIOB_10", "GPIOB_11", "GPIOB_12", "GPIOB_13", "GPIOB_14", "GPIOB_15", "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4", "GPIOC_5", "GPIOC_6", "GPIOC_7", "GPIOC_8", "GPIOC_9", "GPIOC_10", "GPIOC_11", "GPIOC_12", "GPIOC_13", "GPIOC_14", "GPIOC_15", "GPIOD_0", "GPIOD_1", "GPIOD_2", "GPIOD_3", "GPIOD_4", "GPIOD_5", "GPIOD_6", "GPIOD_7", "GPIOD_8", "GPIOD_9", "GPIOD_10", "GPIOD_11", "GPIOD_12", "GPIOD_13", "GPIOD_14", "GPIOD_15", "GPIOE_0", "GPIOE_1", "GPIOE_2", "GPIOE_3", "GPIOE_4", "GPIOE_5", "GPIOE_6", "GPIOE_7", "GPIOE_8", "GPIOE_9", "GPIOE_10", "GPIOE_11", "GPIOE_12", "GPIOE_13", "GPIOE_14", "GPIOE_15", "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"
noAccelAfterHardLimitPeriodSecs = scalar, F32, 1644, "sec", 1, 0, 0, 60, 0
;skipping unused3 offset 1648
;skipping mapAveragingSchedulingAtIndex offset 1648
;skipping unused3 offset 1652
tpsAccelLength = scalar, S32, 2184, "len", 1, 0, 1, 200, 3
tpsAccelEnrichmentThreshold = scalar, F32, 2188, "roc", 1, 0, 0, 200, 3
tpsAccelEnrichmentMultiplier = scalar, F32, 2192, "coeff", 1, 0, 0, 200, 3

View File

@ -62,6 +62,8 @@ public class AutoTest {
x = 688.464;
assertWave(msg, chart, WaveChart.SPARK_1, 0.0597999999, x, x + 180, x + 360, x + 540);
assertWave(msg, chart, WaveChart.MAP_AVERAGING, 0.139, 17.784);
}
private static void testMitsu() {

View File

@ -29,6 +29,7 @@ public class WaveChart {
public static final String TRIGGER_1 = "t1";
public static final String TRIGGER_2 = "t2";
public static final String MAP_AVERAGING = "map";
public final Map<String, StringBuilder> map;