mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
374d907412
commit
a228108f17
|
@ -82,6 +82,7 @@ void setBmwE34(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
// Inputs configuration
|
// Inputs configuration
|
||||||
engineConfiguration->analogInputDividerCoefficient = 1.52;
|
engineConfiguration->analogInputDividerCoefficient = 1.52;
|
||||||
engineConfiguration->vbattDividerCoeff = 5.33;
|
engineConfiguration->vbattDividerCoeff = 5.33;
|
||||||
|
engineConfiguration->vbattAdcChannel = EFI_ADC_15; // PC5
|
||||||
|
|
||||||
boardConfiguration->triggerInputPins[0] = GPIOA_5;
|
boardConfiguration->triggerInputPins[0] = GPIOA_5;
|
||||||
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
|
||||||
|
|
|
@ -19,10 +19,6 @@
|
||||||
#include "listener_array.h"
|
#include "listener_array.h"
|
||||||
#include "accel_enrichment.h"
|
#include "accel_enrichment.h"
|
||||||
|
|
||||||
#define OUTPUT_SIGNAL_MAX_SIZE 45
|
|
||||||
|
|
||||||
typedef ArrayList<OutputSignal, OUTPUT_SIGNAL_MAX_SIZE> OutputSignalList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class knows about when to inject fuel
|
* This class knows about when to inject fuel
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +30,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* this method schedules all fuel events for an engine cycle
|
* this method schedules all fuel events for an engine cycle
|
||||||
*/
|
*/
|
||||||
void addFuelEvents(OutputSignalList *sourceList, injection_mode_e mode DECLARE_ENGINE_PARAMETER_S);
|
void addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_S);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a performance optimization for https://sourceforge.net/p/rusefi/tickets/64/
|
* This is a performance optimization for https://sourceforge.net/p/rusefi/tickets/64/
|
||||||
|
@ -47,7 +43,7 @@ public:
|
||||||
int eventsCount;
|
int eventsCount;
|
||||||
private:
|
private:
|
||||||
void clear();
|
void clear();
|
||||||
void registerInjectionEvent(OutputSignalList *sourceList, NamedOutputPin *output, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
|
void registerInjectionEvent(NamedOutputPin *output, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
class InjectionEvent {
|
class InjectionEvent {
|
||||||
public:
|
public:
|
||||||
event_trigger_position_s injectionStart;
|
event_trigger_position_s injectionStart;
|
||||||
OutputSignal *actuator;
|
OutputSignal actuator;
|
||||||
/**
|
/**
|
||||||
* This is a performance optimization - it's more efficient to handle all
|
* This is a performance optimization - it's more efficient to handle all
|
||||||
* injectors together if that's the case
|
* injectors together if that's the case
|
||||||
|
@ -54,7 +54,9 @@ public:
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ArrayList<InjectionEvent, MAX_EVENT_COUNT> ActuatorEventList;
|
#define OUTPUT_SIGNAL_MAX_SIZE2 45
|
||||||
|
|
||||||
|
typedef ArrayList<InjectionEvent, OUTPUT_SIGNAL_MAX_SIZE2> ActuatorEventList;
|
||||||
|
|
||||||
typedef ArrayList<IgnitionEvent, MAX_EVENT_COUNT> IgnitionEventList;
|
typedef ArrayList<IgnitionEvent, MAX_EVENT_COUNT> IgnitionEventList;
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,6 @@ void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||||
OutputSignalList runningInjectonSignals CCM_OPTIONAL;
|
|
||||||
OutputSignalList crankingInjectonSignals CCM_OPTIONAL;
|
|
||||||
|
|
||||||
void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
||||||
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
||||||
|
@ -110,7 +108,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuelSchedule::registerInjectionEvent(OutputSignalList *sourceList, NamedOutputPin *output, float angle,
|
void FuelSchedule::registerInjectionEvent(NamedOutputPin *output, float angle,
|
||||||
bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
||||||
if (!isSimultanious && !isPinAssigned(output)) {
|
if (!isSimultanious && !isPinAssigned(output)) {
|
||||||
// todo: extact method for this index math
|
// todo: extact method for this index math
|
||||||
|
@ -123,15 +121,12 @@ void FuelSchedule::registerInjectionEvent(OutputSignalList *sourceList, NamedOut
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputSignal *actuator = sourceList->add();
|
ev->actuator.output = output;
|
||||||
actuator->output = output;
|
|
||||||
|
|
||||||
ev->isSimultanious = isSimultanious;
|
ev->isSimultanious = isSimultanious;
|
||||||
|
|
||||||
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape");
|
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape");
|
||||||
|
|
||||||
ev->actuator = actuator;
|
|
||||||
|
|
||||||
findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER);
|
findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER);
|
||||||
if (!hasEvents[ev->injectionStart.eventIndex]) {
|
if (!hasEvents[ev->injectionStart.eventIndex]) {
|
||||||
hasEvents[ev->injectionStart.eventIndex] = true;
|
hasEvents[ev->injectionStart.eventIndex] = true;
|
||||||
|
@ -148,9 +143,9 @@ void FuelSchedule::clear() {
|
||||||
eventsCount = 0;
|
eventsCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_S) {
|
||||||
clear(); // this method is relatively heavy
|
clear(); // this method is relatively heavy
|
||||||
sourceList->reset();
|
// sourceList->reset();
|
||||||
|
|
||||||
events.reset();
|
events.reset();
|
||||||
|
|
||||||
|
@ -174,7 +169,7 @@ void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e
|
||||||
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
|
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
|
||||||
float angle = baseAngle
|
float angle = baseAngle
|
||||||
+ (float) CONFIG(engineCycle) * i / engineConfiguration->specs.cylindersCount;
|
+ (float) CONFIG(engineCycle) * i / engineConfiguration->specs.cylindersCount;
|
||||||
registerInjectionEvent(sourceList, &enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
registerInjectionEvent(&enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IM_SIMULTANEOUS:
|
case IM_SIMULTANEOUS:
|
||||||
|
@ -184,9 +179,9 @@ void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We do not need injector pin here because we will control all injectors
|
* We do not need injector pin here because we will control all injectors
|
||||||
* simultaniously
|
* simultaneously
|
||||||
*/
|
*/
|
||||||
registerInjectionEvent(sourceList, NULL, angle, true PASS_ENGINE_PARAMETER);
|
registerInjectionEvent(NULL, angle, true PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IM_BATCH:
|
case IM_BATCH:
|
||||||
|
@ -194,7 +189,7 @@ void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e
|
||||||
int index = i % (engineConfiguration->specs.cylindersCount / 2);
|
int index = i % (engineConfiguration->specs.cylindersCount / 2);
|
||||||
float angle = baseAngle
|
float angle = baseAngle
|
||||||
+ i * (float) CONFIG(engineCycle) / engineConfiguration->specs.cylindersCount;
|
+ i * (float) CONFIG(engineCycle) / engineConfiguration->specs.cylindersCount;
|
||||||
registerInjectionEvent(sourceList, &enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
registerInjectionEvent(&enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
||||||
|
|
||||||
if (CONFIG(twoWireBatch)) {
|
if (CONFIG(twoWireBatch)) {
|
||||||
|
|
||||||
|
@ -202,7 +197,7 @@ void FuelSchedule::addFuelEvents(OutputSignalList *sourceList, injection_mode_e
|
||||||
* also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires
|
* also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires
|
||||||
*/
|
*/
|
||||||
index = index + (CONFIG(specs.cylindersCount) / 2);
|
index = index + (CONFIG(specs.cylindersCount) / 2);
|
||||||
registerInjectionEvent(sourceList, &enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
registerInjectionEvent(&enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -376,9 +371,9 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
TRIGGER_SHAPE(triggerIndexByAngle[angle]) = triggerShapeIndex;
|
TRIGGER_SHAPE(triggerIndexByAngle[angle]) = triggerShapeIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
engineConfiguration2->crankingInjectionEvents.addFuelEvents(&crankingInjectonSignals,
|
engineConfiguration2->crankingInjectionEvents.addFuelEvents(
|
||||||
engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER);
|
engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER);
|
||||||
engineConfiguration2->injectionEvents.addFuelEvents(&runningInjectonSignals,
|
engineConfiguration2->injectionEvents.addFuelEvents(
|
||||||
engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
|
engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -383,7 +383,10 @@ static void printThermistor(const char *msg, Thermistor *thermistor) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
static void printMAPInfo(void) {
|
static void printMAPInfo(void) {
|
||||||
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__)
|
||||||
scheduleMsg(&logger, "map type=%d raw=%f MAP=%f", engineConfiguration->map.sensor.type, getRawMap(), getMap());
|
scheduleMsg(&logger, "map type=%d/%s raw=%f MAP=%f", engineConfiguration->map.sensor.type,
|
||||||
|
getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type),
|
||||||
|
|
||||||
|
getRawMap(), getMap());
|
||||||
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
|
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
|
||||||
scheduleMsg(&logger, "at0=%f at5=%f", engineConfiguration->map.sensor.valueAt0,
|
scheduleMsg(&logger, "at0=%f at5=%f", engineConfiguration->map.sensor.valueAt0,
|
||||||
engineConfiguration->map.sensor.valueAt5);
|
engineConfiguration->map.sensor.valueAt5);
|
||||||
|
|
|
@ -128,7 +128,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(InjectionEvent *event, int rp
|
||||||
* 'scheduleOutput' is currently only used for injection, so maybe it should be
|
* 'scheduleOutput' is currently only used for injection, so maybe it should be
|
||||||
* changed into 'scheduleInjection' and unified? todo: think about it.
|
* changed into 'scheduleInjection' and unified? todo: think about it.
|
||||||
*/
|
*/
|
||||||
OutputSignal *signal = event->actuator;
|
OutputSignal *signal = &event->actuator;
|
||||||
efiAssertVoid(signal!=NULL, "signal is NULL");
|
efiAssertVoid(signal!=NULL, "signal is NULL");
|
||||||
int index = getRevolutionCounter() % 2;
|
int index = getRevolutionCounter() % 2;
|
||||||
scheduling_s * sUp = &signal->signalTimerUp[index];
|
scheduling_s * sUp = &signal->signalTimerUp[index];
|
||||||
|
@ -138,7 +138,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(InjectionEvent *event, int rp
|
||||||
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 {
|
} else {
|
||||||
scheduleOutput(event->actuator, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration));
|
scheduleOutput(&event->actuator, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,9 +293,6 @@ static void ignitionCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
engine->advance = -ENGINE(engineState.timingAdvance);
|
engine->advance = -ENGINE(engineState.timingAdvance);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern OutputSignalList runningInjectonSignals CCM_OPTIONAL;
|
|
||||||
extern OutputSignalList crankingInjectonSignals CCM_OPTIONAL;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main trigger event handler.
|
* This is the main trigger event handler.
|
||||||
* Both injection and ignition are controlled from this method.
|
* Both injection and ignition are controlled from this method.
|
||||||
|
@ -394,10 +391,10 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
||||||
engine->m.beforeInjectonSch = GET_TIMESTAMP();
|
engine->m.beforeInjectonSch = GET_TIMESTAMP();
|
||||||
|
|
||||||
if (isCrankingR(rpm)) {
|
if (isCrankingR(rpm)) {
|
||||||
ENGINE(engineConfiguration2)->crankingInjectionEvents.addFuelEvents(&crankingInjectonSignals,
|
ENGINE(engineConfiguration2)->crankingInjectionEvents.addFuelEvents(
|
||||||
engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER);
|
engineConfiguration->crankingInjectionMode PASS_ENGINE_PARAMETER);
|
||||||
} else {
|
} else {
|
||||||
ENGINE(engineConfiguration2)->injectionEvents.addFuelEvents(&runningInjectonSignals,
|
ENGINE(engineConfiguration2)->injectionEvents.addFuelEvents(
|
||||||
engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
|
engineConfiguration->injectionMode PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
engine->m.injectonSchTime = GET_TIMESTAMP() - engine->m.beforeInjectonSch;
|
engine->m.injectonSchTime = GET_TIMESTAMP() - engine->m.beforeInjectonSch;
|
||||||
|
|
|
@ -465,26 +465,30 @@ static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addChannel(adc_channel_e setting, adc_channel_mode_e mode) {
|
static void addChannel(const char *name, adc_channel_e setting, adc_channel_mode_e mode) {
|
||||||
if (setting == EFI_ADC_NONE) {
|
if (setting == EFI_ADC_NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (adcHwChannelEnabled[setting] != ADC_OFF) {
|
||||||
|
firmwareError("ADC mapping error: input for %s already used?", name);
|
||||||
|
}
|
||||||
|
|
||||||
adcHwChannelEnabled[setting] = mode;
|
adcHwChannelEnabled[setting] = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void configureInputs(void) {
|
static void configureInputs(void) {
|
||||||
memset(adcHwChannelEnabled, 0, sizeof(adcHwChannelEnabled));
|
memset(adcHwChannelEnabled, 0, sizeof(adcHwChannelEnabled));
|
||||||
|
|
||||||
addChannel(engineConfiguration->tpsAdcChannel, ADC_FAST);
|
addChannel("TPS", engineConfiguration->tpsAdcChannel, ADC_FAST);
|
||||||
addChannel(engineConfiguration->map.sensor.hwChannel, ADC_FAST);
|
addChannel("MAP", engineConfiguration->map.sensor.hwChannel, ADC_FAST);
|
||||||
addChannel(engineConfiguration->mafAdcChannel, ADC_FAST);
|
addChannel("MAF", engineConfiguration->mafAdcChannel, ADC_FAST);
|
||||||
addChannel(engineConfiguration->hipOutputChannel, ADC_FAST);
|
addChannel("hip", engineConfiguration->hipOutputChannel, ADC_FAST);
|
||||||
|
|
||||||
addChannel(engineConfiguration->vbattAdcChannel, ADC_SLOW);
|
addChannel("VBatt", engineConfiguration->vbattAdcChannel, ADC_SLOW);
|
||||||
addChannel(engineConfiguration->cltAdcChannel, ADC_SLOW);
|
addChannel("CLT", engineConfiguration->cltAdcChannel, ADC_SLOW);
|
||||||
addChannel(engineConfiguration->iatAdcChannel, ADC_SLOW);
|
addChannel("IAT", engineConfiguration->iatAdcChannel, ADC_SLOW);
|
||||||
addChannel(engineConfiguration->afr.hwChannel, ADC_SLOW);
|
addChannel("AFR", engineConfiguration->afr.hwChannel, ADC_SLOW);
|
||||||
addChannel(engineConfiguration->acSwitchAdc, ADC_SLOW);
|
addChannel("AC", engineConfiguration->acSwitchAdc, ADC_SLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initAdcInputs(bool boardTestMode) {
|
void initAdcInputs(bool boardTestMode) {
|
||||||
|
|
|
@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20150428;
|
return 20150430;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,8 +186,6 @@ void testAngleResolver(void) {
|
||||||
|
|
||||||
assertEqualsM("shape size", 10, ts->getSize());
|
assertEqualsM("shape size", 10, ts->getSize());
|
||||||
|
|
||||||
OutputSignalList list;
|
|
||||||
|
|
||||||
ae.reset();
|
ae.reset();
|
||||||
printf("*************************************************** testAngleResolver 0\r\n");
|
printf("*************************************************** testAngleResolver 0\r\n");
|
||||||
findTriggerPosition(&ae.add()->injectionStart, -122 PASS_ENGINE_PARAMETER);
|
findTriggerPosition(&ae.add()->injectionStart, -122 PASS_ENGINE_PARAMETER);
|
||||||
|
|
Loading…
Reference in New Issue