auto-sync

This commit is contained in:
rusEfi 2015-04-18 21:06:05 -04:00
parent f2fbb64556
commit e313a54fea
6 changed files with 26 additions and 7 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

@ -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;