auto-sync

This commit is contained in:
rusEfi 2014-09-11 20:02:50 -05:00
parent 4ab78bce6e
commit 9d096ab649
9 changed files with 78 additions and 65 deletions

View File

@ -221,8 +221,7 @@ static char pinNameBuffer[16];
static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage) {
float voltage = adcVoltage * engineConfiguration->analogInputDividerCoefficient;
scheduleMsg(&logger, "%s ADC%d %s %s rawValue=%f/divided=%fv", name, hwChannel,
getAdcMode(hwChannel),
scheduleMsg(&logger, "%s ADC%d %s %s rawValue=%f/divided=%fv", name, hwChannel, getAdcMode(hwChannel),
getPinNameByAdcChannel(hwChannel, pinNameBuffer), adcVoltage, voltage);
}
@ -244,11 +243,11 @@ static void printAnalogInfo(void) {
static THD_WORKING_AREA(csThreadStack, UTILITY_THREAD_STACK_SIZE); // declare thread stack
void initEngineContoller(void) {
if (hasFirmwareError())
if (hasFirmwareError()) {
return;
}
initLogging(&logger, "Engine Controller");
initSensors();
initPwmGenerator();
@ -298,10 +297,12 @@ void initEngineContoller(void) {
#endif /* EFI_MAP_AVERAGING */
#if EFI_ENGINE_CONTROL
/**
* This method initialized the main listener which actually runs injectors & ignition
*/
initMainEventListener(&engine, engineConfiguration2);
if (boardConfiguration->isEngineControlEnabled) {
/**
* This method initialized the main listener which actually runs injectors & ignition
*/
initMainEventListener(&engine, engineConfiguration2);
}
#endif /* EFI_ENGINE_CONTROL */
#if EFI_IDLE_CONTROL

View File

@ -173,25 +173,6 @@ void initializeSkippedToothTriggerShapeExt(trigger_shape_s *s, int totalTeethCou
s->wave.checkSwitchTimes(s->getSize());
}
static void configureFordAspireTriggerShape(trigger_config_s *triggerConfig, trigger_shape_s * s) {
s->isSynchronizationNeeded = false;
s->reset(FOUR_STROKE_CAM_SENSOR);
s->shaftPositionEventCount = 10;
s->addEvent(53.747, T_SECONDARY, TV_HIGH);
s->addEvent(121.90, T_SECONDARY, TV_LOW); // delta = 68.153
s->addEvent(232.76, T_SECONDARY, TV_HIGH); // delta = 110.86
s->addEvent(300.54, T_SECONDARY, TV_LOW); // delta = 67.78
s->addEvent(360, T_PRIMARY, TV_HIGH);
s->addEvent(409.8412, T_SECONDARY, TV_HIGH); // delta = 49.8412
s->addEvent(478.6505, T_SECONDARY, TV_LOW); // delta = 68.8093
s->addEvent(588.045, T_SECONDARY, TV_HIGH); // delta = 109.3945
s->addEvent(657.03, T_SECONDARY, TV_LOW);
s->addEvent(720, T_PRIMARY, TV_LOW);
}
/**
* External logger is needed because at this point our logger is not yet initialized
*/

View File

@ -7,6 +7,28 @@
#include "trigger_mitsubishi.h"
void configureFordAspireTriggerShape(trigger_config_s *triggerConfig, trigger_shape_s * s) {
s->isSynchronizationNeeded = false;
s->reset(FOUR_STROKE_CAM_SENSOR);
s->shaftPositionEventCount = 10;
float x = 121.90;
float y = 110.86;
s->addEvent(x + y - 180, T_SECONDARY, TV_HIGH);
s->addEvent(x, T_SECONDARY, TV_LOW);
s->addEvent(x + y, T_SECONDARY, TV_HIGH);
s->addEvent(x + 180, T_SECONDARY, TV_LOW);
s->addEvent(360, T_PRIMARY, TV_HIGH);
s->addEvent(x + 180 + y, T_SECONDARY, TV_HIGH);
s->addEvent(x + 360, T_SECONDARY, TV_LOW);
s->addEvent(x + 360 + y, T_SECONDARY, TV_HIGH);
s->addEvent(x + 540, T_SECONDARY, TV_LOW);
s->addEvent(720, T_PRIMARY, TV_LOW);
}
void initializeMitsubishi4g18(trigger_shape_s *s) {
s->reset(FOUR_STROKE_CAM_SENSOR);
s->useRiseEdge = false;

View File

@ -10,5 +10,6 @@
#include "trigger_structure.h"
void initializeMitsubishi4g18(trigger_shape_s *s);
void configureFordAspireTriggerShape(trigger_config_s *triggerConfig, trigger_shape_s * s);
#endif /* TRIGGER_MITSUBISHI_H_ */

View File

@ -104,11 +104,11 @@ static void setWaveModeSilent(int index, int mode) {
setWaveReaderMode(&reader->hw, mode);
}
static int getEventCounter(int index) {
WaveReader *reader = &readers[index];
ensureInitialized(reader);
return reader->eventCounter;
}
//static int getEventCounter(int index) {
// WaveReader *reader = &readers[index];
// ensureInitialized(reader);
// return reader->eventCounter;
//}
static void initWave(const char *name, int index) {
brain_pin_e brainPin = boardConfiguration->logicAnalyzerPins[index];
@ -191,48 +191,49 @@ static float getSignalPeriodMs(int index) {
return reader->signalPeriodUs / 1000.0f;
}
static uint64_t getWidthEventTime(int index) {
WaveReader *reader = &readers[index];
ensureInitialized(reader);
return reader->widthEventTimeUs;
}
//static uint64_t getWidthEventTime(int index) {
// WaveReader *reader = &readers[index];
// ensureInitialized(reader);
// return reader->widthEventTimeUs;
//}
static void reportWave(Logging *logging, int index) {
if (readers[index].hw.started) {
// int counter = getEventCounter(index);
// debugInt2(logging, "ev", index, counter);
float dwellMs = getSignalOnTime(index);
float periodMs = getSignalPeriodMs(index);
float dwellMs = getSignalOnTime(index);
float periodMs = getSignalPeriodMs(index);
appendPrintf(logging, "duty%d%s", index, DELIMETER);
appendFloat(logging, 100.0f * dwellMs / periodMs, 2);
appendPrintf(logging, "%s", DELIMETER);
appendPrintf(logging, "duty%d%s", index, DELIMETER);
appendFloat(logging, 100.0f * dwellMs / periodMs, 2);
appendPrintf(logging, "%s", DELIMETER);
/**
* that's the ON time of the LAST signal
*/
appendPrintf(logging, "dwell%d%s", index, DELIMETER);
appendFloat(logging, dwellMs, 2);
appendPrintf(logging, "%s", DELIMETER);
/**
* that's the ON time of the LAST signal
*/
appendPrintf(logging, "dwell%d%s", index, DELIMETER);
appendFloat(logging, dwellMs, 2);
appendPrintf(logging, "%s", DELIMETER);
/**
* that's the total ON time during the previous engine cycle
*/
appendPrintf(logging, "total_dwell%d%s", index, DELIMETER);
appendFloat(logging, readers[index].prevTotalOnTimeUs / 1000.0f, 2);
appendPrintf(logging, "%s", DELIMETER);
/**
* that's the total ON time during the previous engine cycle
*/
appendPrintf(logging, "total_dwell%d%s", index, DELIMETER);
appendFloat(logging, readers[index].prevTotalOnTimeUs / 1000.0f, 2);
appendPrintf(logging, "%s", DELIMETER);
appendPrintf(logging, "period%d%s", index, DELIMETER);
appendFloat(logging, periodMs, 2);
appendPrintf(logging, "%s", DELIMETER);
appendPrintf(logging, "period%d%s", index, DELIMETER);
appendFloat(logging, periodMs, 2);
appendPrintf(logging, "%s", DELIMETER);
uint32_t offsetUs = getWaveOffset(index);
float oneDegreeUs = getOneDegreeTimeUs(getRpm());
uint32_t offsetUs = getWaveOffset(index);
float oneDegreeUs = getOneDegreeTimeUs(getRpm());
appendPrintf(logging, "advance%d%s", index, DELIMETER);
appendFloat(logging, fixAngle((offsetUs / oneDegreeUs) - engineConfiguration->globalTriggerAngleOffset), 3);
appendPrintf(logging, "%s", DELIMETER);
appendPrintf(logging, "advance%d%s", index, DELIMETER);
appendFloat(logging, fixAngle((offsetUs / oneDegreeUs) - engineConfiguration->globalTriggerAngleOffset), 3);
appendPrintf(logging, "%s", DELIMETER);
}
}
void printWave(Logging *logging) {

View File

@ -75,6 +75,7 @@ public class EngineState {
SensorStats.startStandardDeviation(Sensor.DWELL0, Sensor.DWELL0_SD);
SensorStats.startDelta(Sensor.INJECTOR_1_DWELL, Sensor.INJECTOR_2_DWELL, Sensor.INJ_1_2_DELTA);
SensorStats.startDelta(Sensor.INJECTOR_3_DWELL, Sensor.INJECTOR_4_DWELL, Sensor.INJ_3_4_DELTA);
registerStringValueAction("adcfast_co", NOTHING);
registerStringValueAction("adcfast_max", NOTHING);

View File

@ -69,9 +69,13 @@ public enum Sensor {
ADC_FAST_AVG("ADC_FAST_AVG", "b", 4000),
INJECTOR_1_DWELL("inj #1"),
INJECTOR_2_DWELL("inj #2"),
INJECTOR_3_DWELL("inj #3"),
INJECTOR_4_DWELL("inj #4"),
INJ_1_2_DELTA("inj 1-2 delta"),;
INJ_1_2_DELTA("inj 1-2 delta"),
INJ_3_4_DELTA("inj 3-4 delta"),
;
private final String name;
private final String units;

View File

@ -42,6 +42,8 @@ public class UpDownImage extends JPanel {
static {
name2sensor.put("inj1", Sensor.INJECTOR_1_DWELL);
name2sensor.put("inj2", Sensor.INJECTOR_2_DWELL);
name2sensor.put("inj3", Sensor.INJECTOR_3_DWELL);
name2sensor.put("inj4", Sensor.INJECTOR_4_DWELL);
}
public UpDownImage(final String name) {

View File

@ -458,7 +458,7 @@ void testTriggerDecoder(void) {
testFordAspire();
// lame duty cycle implementation!
testTriggerDecoder2("ford aspire", FORD_ASPIRE_1996, 4, 0.5, 0.3802);
testTriggerDecoder2("ford aspire", FORD_ASPIRE_1996, 4, 0.5, 0.3841);
test1995FordInline6TriggerDecoder();
testMazdaMianaNbDecoder();