mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
eb28b70d90
commit
3d11c62246
|
@ -22,10 +22,10 @@ void setGy6139qmbDefaultEngineConfiguration(
|
|||
engineConfiguration->globalTriggerAngleOffset = 45;
|
||||
engineConfiguration->bc.analogChartMode = AC_MAP;
|
||||
engineConfiguration->specs.displacement = 0.072; // 72cc
|
||||
engineConfiguration->cylindersCount = 1;
|
||||
engineConfiguration->specs.cylindersCount = 1;
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
|
||||
engineConfiguration->firingOrder = FO_ONE_CYLINDER;
|
||||
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;
|
||||
|
||||
/**
|
||||
* We treat the trigger as 8-1 toothed wheel
|
||||
|
|
|
@ -15,6 +15,6 @@ void setAcuraRSX(engine_configuration_s *engineConfiguration) {
|
|||
// http://injectordynamics.com/injectors/id1300-2/
|
||||
engineConfiguration->injector.flow = 1300;
|
||||
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ void setBmwE34(engine_configuration_s *engineConfiguration) {
|
|||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
engineConfiguration->cylindersCount = 6;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4;
|
||||
engineConfiguration->specs.cylindersCount = 6;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4;
|
||||
engineConfiguration->injectionMode = IM_SIMULTANEOUS;
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ static const ignition_table_t tps_advance_table = {
|
|||
{/*15 engineLoad=100.00*/ /*0 800.0*/+12.00, /*1 1213.0*/+13.20, /*2 1626.0*/+14.40, /*3 2040.0*/+15.60, /*4 2453.0*/+16.80, /*5 2866.0*/+18.00, /*6 3280.0*/+19.20, /*7 3693.0*/+20.40, /*8 4106.0*/+21.60, /*9 4520.0*/+22.80, /*10 4933.0*/+24.00, /*11 5346.0*/+25.20, /*12 5760.0*/+26.40, /*13 6173.0*/+27.60, /*14 6586.0*/+28.80, /*15 7000.0*/+30.00}
|
||||
};
|
||||
|
||||
|
||||
void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
|
@ -65,9 +64,9 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur
|
|||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
engineConfiguration->globalTriggerAngleOffset = 114;
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 1.360;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->injectionMode = IM_BATCH;
|
||||
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
||||
|
|
|
@ -72,7 +72,7 @@ void setCustomEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
|||
/**
|
||||
* We want to initialize all outputs for test
|
||||
*/
|
||||
engineConfiguration->cylindersCount = 12;
|
||||
engineConfiguration->specs.cylindersCount = 12;
|
||||
|
||||
engineConfiguration->displayMode = DM_NONE;
|
||||
#else
|
||||
|
@ -91,6 +91,8 @@ void setCustomEngineConfiguration(engine_configuration_s *engineConfiguration) {
|
|||
boardConfiguration->ignitionPins[3] = GPIOE_1; // todo: update this value
|
||||
#endif
|
||||
|
||||
// todo: 8.2 or 10k?
|
||||
engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ENGINES_CUSTOM_ENGINE_CPP_ */
|
||||
|
|
|
@ -123,7 +123,7 @@ void setDodgeNeon1995EngineConfiguration(engine_configuration_s *engineConfigura
|
|||
// set_ignition_mode 2
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
// set_firing_order 2
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
|
||||
// set_global_trigger_offset_angle 497
|
||||
engineConfiguration->globalTriggerAngleOffset = 497;
|
||||
|
@ -194,7 +194,7 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
|
|||
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->specs.displacement = 1.996;
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
|
||||
/**
|
||||
* that's NGC config
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
* @brief Default values for persistent properties
|
||||
*/
|
||||
void setFordInline6(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration) {
|
||||
engineConfiguration->cylindersCount = 6;
|
||||
engineConfiguration->specs.cylindersCount = 6;
|
||||
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
|
||||
|
||||
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4;
|
||||
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
||||
engineConfiguration->injectionMode = IM_BATCH;
|
||||
engineConfiguration->twoWireBatch = true;
|
||||
|
|
|
@ -93,12 +93,12 @@ void setFordAspireEngineConfiguration(engine_configuration_s *engineConfiguratio
|
|||
|
||||
// engineConfiguration->ignitionPinMode = OM_INVERTED;
|
||||
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 1.3;
|
||||
// Denso 195500-2110
|
||||
engineConfiguration->injector.flow = 119.8;
|
||||
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->globalTriggerAngleOffset = 175;
|
||||
engineConfiguration->ignitionBaseAngle = 98 - 11;
|
||||
engineConfiguration->injectionAngle = 59;
|
||||
|
|
|
@ -23,7 +23,7 @@ void setFordFiestaDefaultEngineConfiguration(engine_configuration_s *engineConfi
|
|||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;
|
||||
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
}
|
||||
|
||||
#endif /* EFI_SUPPORT_FORD_FIESTA */
|
||||
|
|
|
@ -39,7 +39,7 @@ static void setHondaAccordConfigurationCommon(engine_configuration_s *engineConf
|
|||
|
||||
engineConfiguration->HD44780height = 4;
|
||||
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 2.156;
|
||||
|
||||
// Keihin 06164-P0A-A00
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "mazda_323.h"
|
||||
|
||||
void setMazda323EngineConfiguration(engine_configuration_s *engineConfiguration) {
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 1.6;
|
||||
|
||||
engineConfiguration->ignitionMode = IM_ONE_COIL;
|
||||
|
|
|
@ -70,4 +70,6 @@ void setMazda626EngineConfiguration(engine_configuration_s *engineConfiguration)
|
|||
|
||||
boardConfiguration->ignitionPins[0] = GPIOC_7;
|
||||
|
||||
// todo: 8.2 or 10k?
|
||||
engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
|
||||
}
|
||||
|
|
|
@ -169,8 +169,8 @@ static void common079721_2351(engine_configuration_s *engineConfiguration, board
|
|||
|
||||
engineConfiguration->digitalChartSize = 150;
|
||||
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
|
||||
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; // fuel pump is not controlled by ECU on this engine
|
||||
|
||||
|
@ -324,7 +324,7 @@ void setFordEscortGt(engine_configuration_s *engineConfiguration) {
|
|||
engineConfiguration->iatAdcChannel = EFI_ADC_11;
|
||||
|
||||
// todo: 8.2 or 10k?
|
||||
engineConfiguration->vbattDividerCoeff = ((float) (8.2 + 33)) / 8.2 * 2;
|
||||
engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;
|
||||
|
||||
// end of Ford Escort GT config
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfigurat
|
|||
// set_ignition_mode 2
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
// set_firing_order 2
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
|
||||
setThermistorConfiguration(&engineConfiguration->clt, 0, 32500, 30, 7550, 100, 700);
|
||||
engineConfiguration->clt.bias_resistor = 2700;
|
||||
|
|
|
@ -18,12 +18,12 @@ void setMitsubishiConfiguration(engine_configuration_s *engineConfiguration, boa
|
|||
|
||||
engineConfiguration->trigger.type = TT_MITSU;
|
||||
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 1.800;
|
||||
|
||||
// set_ignition_mode 2
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
|
||||
// set_global_trigger_offset_angle 671
|
||||
engineConfiguration->globalTriggerAngleOffset = 671;
|
||||
|
|
|
@ -30,8 +30,8 @@ void setRoverv8(engine_configuration_s *engineConfiguration) {
|
|||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;
|
||||
|
||||
engineConfiguration->specs.displacement = 3.528;
|
||||
engineConfiguration->cylindersCount = 8;
|
||||
engineConfiguration->firingOrder = FO_1_8_4_3_6_5_7_2;
|
||||
engineConfiguration->specs.cylindersCount = 8;
|
||||
engineConfiguration->specs.firingOrder = FO_1_8_4_3_6_5_7_2;
|
||||
|
||||
// set_rpm_hard_limit 4000
|
||||
engineConfiguration->rpmHardLimit = 4000; // yes, 4k. let's play it safe for now
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
|
||||
void setSachs(engine_configuration_s *engineConfiguration) {
|
||||
engineConfiguration->specs.displacement = 0.1; // 100cc
|
||||
engineConfiguration->cylindersCount = 1;
|
||||
engineConfiguration->specs.cylindersCount = 1;
|
||||
engineConfiguration->engineCycle = 360;
|
||||
|
||||
engineConfiguration->firingOrder = FO_ONE_CYLINDER;
|
||||
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;
|
||||
|
||||
/**
|
||||
* We treat the trigger as 1/0 toothed wheel
|
||||
|
|
|
@ -315,7 +315,7 @@ static void printInfo(Engine *engine, systime_t nowSeconds) {
|
|||
printOutPin(WA_CHANNEL_2, boardConfiguration->logicAnalyzerPins[1]);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
printOutPin(enginePins.coils[i].name,
|
||||
boardConfiguration->ignitionPins[i]);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ static bool stopPin(NamedOutputPin *output) {
|
|||
|
||||
bool Engine::stopPins() {
|
||||
bool result = false;
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
result |= stopPin(&enginePins.coils[i]);
|
||||
result |= stopPin(&enginePins.injectors[i]);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ int getGlobalConfigurationVersion(void) {
|
|||
|
||||
void incrementGlobalConfigurationVersion(void) {
|
||||
globalConfigurationVersion++;
|
||||
// todo invoke engine->configurationListeners.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,7 +250,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
|
|||
engineConfiguration->map.sensor.hwChannel = EFI_ADC_4;
|
||||
engineConfiguration->baroSensor.hwChannel = EFI_ADC_4;
|
||||
|
||||
engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->specs.firingOrder = FO_1_THEN_3_THEN_4_THEN2;
|
||||
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
|
||||
engineConfiguration->injectionMode = IM_SEQUENTIAL;
|
||||
|
||||
|
@ -278,7 +279,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_
|
|||
engineConfiguration->canWriteEnabled = false;
|
||||
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
|
||||
engineConfiguration->cylindersCount = 4;
|
||||
engineConfiguration->specs.cylindersCount = 4;
|
||||
engineConfiguration->specs.displacement = 2;
|
||||
/**
|
||||
* By the way http://users.erols.com/srweiss/tableifc.htm has a LOT of data
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated by config_definition.jar on Sat Feb 07 09:06:02 BOT 2015
|
||||
// this section was generated by config_definition.jar on Sun Feb 08 19:20:53 BOT 2015
|
||||
// begin
|
||||
#include "rusefi_types.h"
|
||||
typedef struct {
|
||||
|
@ -152,7 +152,15 @@ typedef struct {
|
|||
* offset 0
|
||||
*/
|
||||
float displacement;
|
||||
/** total size 4*/
|
||||
/**
|
||||
* offset 4
|
||||
*/
|
||||
cylinders_count_t cylindersCount;
|
||||
/**
|
||||
* offset 8
|
||||
*/
|
||||
firing_order_e firingOrder;
|
||||
/** total size 12*/
|
||||
} specs_s;
|
||||
|
||||
/**
|
||||
|
@ -724,14 +732,6 @@ typedef struct {
|
|||
* offset 924
|
||||
*/
|
||||
specs_s specs;
|
||||
/**
|
||||
* offset 928
|
||||
*/
|
||||
cylinders_count_t cylindersCount;
|
||||
/**
|
||||
* offset 932
|
||||
*/
|
||||
firing_order_e firingOrder;
|
||||
/**
|
||||
* offset 936
|
||||
*/
|
||||
|
@ -1130,4 +1130,4 @@ typedef struct {
|
|||
} engine_configuration_s;
|
||||
|
||||
// end
|
||||
// this section was generated by config_definition.jar on Sat Feb 07 09:06:02 BOT 2015
|
||||
// this section was generated by config_definition.jar on Sun Feb 08 19:20:53 BOT 2015
|
||||
|
|
|
@ -60,11 +60,11 @@ float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
|||
static int getNumberOfInjections(engine_configuration_s const *engineConfiguration, injection_mode_e mode) {
|
||||
switch (mode) {
|
||||
case IM_SIMULTANEOUS:
|
||||
return engineConfiguration->cylindersCount;
|
||||
return engineConfiguration->specs.cylindersCount;
|
||||
case IM_SEQUENTIAL:
|
||||
return 1;
|
||||
case IM_BATCH:
|
||||
return engineConfiguration->cylindersCount / 2;
|
||||
return engineConfiguration->specs.cylindersCount / 2;
|
||||
default:
|
||||
firmwareError("Unexpected getFuelMultiplier %d", mode);
|
||||
return 1;
|
||||
|
|
|
@ -44,8 +44,8 @@ void Table2D::preCalc(float *bin, float *values) {
|
|||
}
|
||||
}
|
||||
|
||||
void setTableBin(float array[], int size, float l, float r) {
|
||||
setTableBin2(array, size, l, r, 0.01);
|
||||
void setTableBin(float array[], int size, float from, float to) {
|
||||
setTableBin2(array, size, from, to, 0.01);
|
||||
}
|
||||
|
||||
void setRpmTableBin(float array[], int size) {
|
||||
|
|
|
@ -45,7 +45,7 @@ static int is_injector_enabled[MAX_INJECTOR_COUNT];
|
|||
extern engine_pins_s enginePins;
|
||||
|
||||
void initIgnitionCentral(void) {
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
NamedOutputPin *output = &enginePins.coils[i];
|
||||
outputPinRegisterExt2(output->name, output, boardConfiguration->ignitionPins[i], &boardConfiguration->ignitionPinMode);
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ bool_t isRunningBenchTest(void) {
|
|||
}
|
||||
|
||||
void assertCylinderId(int cylinderId, const char *msg) {
|
||||
int isValid = cylinderId >= 1 && cylinderId <= engineConfiguration->cylindersCount;
|
||||
int isValid = cylinderId >= 1 && cylinderId <= engineConfiguration->specs.cylindersCount;
|
||||
if (!isValid) {
|
||||
// we are here only in case of a fatal issue - at this point it is fine to make some blocking i-o
|
||||
//scheduleSimpleMsg(&logger, "cid=", cylinderId);
|
||||
|
@ -74,7 +74,7 @@ int isInjectorEnabled(int cylinderId) {
|
|||
}
|
||||
|
||||
static void printStatus(void) {
|
||||
for (int id = 1; id <= engineConfiguration->cylindersCount; id++) {
|
||||
for (int id = 1; id <= engineConfiguration->specs.cylindersCount; id++) {
|
||||
resetLogging(&logger);
|
||||
|
||||
appendPrintf(&logger, "injector%d%s", id, DELIMETER);
|
||||
|
@ -85,7 +85,7 @@ static void printStatus(void) {
|
|||
}
|
||||
|
||||
static void setInjectorEnabled(int id, int value) {
|
||||
efiAssertVoid(id >= 0 && id < engineConfiguration->cylindersCount, "injector id");
|
||||
efiAssertVoid(id >= 0 && id < engineConfiguration->specs.cylindersCount, "injector id");
|
||||
is_injector_enabled[id] = value;
|
||||
printStatus();
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ static void pinbench(const char *delayStr, const char *onTimeStr, const char *of
|
|||
static void fuelbench2(const char *delayStr, const char *indexStr, const char * onTimeStr, const char *offTimeStr,
|
||||
const char *countStr) {
|
||||
int index = atoi(indexStr);
|
||||
if (index < 1 || index > engineConfiguration->cylindersCount) {
|
||||
if (index < 1 || index > engineConfiguration->specs.cylindersCount) {
|
||||
scheduleMsg(&logger, "Invalid index: %d", index);
|
||||
return;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ static void fuelbench(const char * onTimeStr, const char *offTimeStr, const char
|
|||
static void sparkbench2(const char *delayStr, const char *indexStr, const char * onTimeStr, const char *offTimeStr,
|
||||
const char *countStr) {
|
||||
int index = atoi(indexStr);
|
||||
if (index < 1 || index > engineConfiguration->cylindersCount) {
|
||||
if (index < 1 || index > engineConfiguration->specs.cylindersCount) {
|
||||
scheduleMsg(&logger, "Invalid index: %d", index);
|
||||
return;
|
||||
}
|
||||
|
@ -211,12 +211,12 @@ void initInjectorCentral(Engine *engine) {
|
|||
initLogging(&logger, "InjectorCentral");
|
||||
chThdCreateStatic(benchThreadStack, sizeof(benchThreadStack), NORMALPRIO, (tfunc_t) benchThread, NULL);
|
||||
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
is_injector_enabled[i] = true;
|
||||
}
|
||||
|
||||
// todo: should we move this code closer to the injection logic?
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
NamedOutputPin *output = &enginePins.injectors[i];
|
||||
|
||||
outputPinRegisterExt2(output->name, output, boardConfiguration->injectionPins[i],
|
||||
|
|
|
@ -92,11 +92,11 @@ OutputSignalList injectonSignals CCM_OPTIONAL;
|
|||
|
||||
void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
||||
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
||||
efiAssertVoid(engineConfiguration->cylindersCount > 0, "cylindersCount");
|
||||
efiAssertVoid(engineConfiguration->specs.cylindersCount > 0, "cylindersCount");
|
||||
|
||||
list->reset();
|
||||
|
||||
for (int i = 0; i < CONFIG(cylindersCount); i++) {
|
||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||
float localAdvance = advance + ENGINE(angleExtra[i]);
|
||||
NamedOutputPin *output = ENGINE(ignitionPin[i]);
|
||||
|
||||
|
@ -156,17 +156,17 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
|||
|
||||
switch (mode) {
|
||||
case IM_SEQUENTIAL:
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
int index = getCylinderId(engineConfiguration->firingOrder, i) - 1;
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
|
||||
float angle = baseAngle
|
||||
+ (float) engineConfiguration->engineCycle * i / engineConfiguration->cylindersCount;
|
||||
+ (float) engineConfiguration->engineCycle * i / engineConfiguration->specs.cylindersCount;
|
||||
registerInjectionEvent(&enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
break;
|
||||
case IM_SIMULTANEOUS:
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
float angle = baseAngle
|
||||
+ (float) engineConfiguration->engineCycle * i / engineConfiguration->cylindersCount;
|
||||
+ (float) engineConfiguration->engineCycle * i / engineConfiguration->specs.cylindersCount;
|
||||
|
||||
/**
|
||||
* We do not need injector pin here because we will control all injectors
|
||||
|
@ -176,10 +176,10 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
|||
}
|
||||
break;
|
||||
case IM_BATCH:
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
int index = i % (engineConfiguration->cylindersCount / 2);
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
int index = i % (engineConfiguration->specs.cylindersCount / 2);
|
||||
float angle = baseAngle
|
||||
+ i * (float) engineConfiguration->engineCycle / engineConfiguration->cylindersCount;
|
||||
+ i * (float) engineConfiguration->engineCycle / engineConfiguration->specs.cylindersCount;
|
||||
registerInjectionEvent(&enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
||||
|
||||
if (engineConfiguration->twoWireBatch) {
|
||||
|
@ -187,7 +187,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
|||
/**
|
||||
* also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires
|
||||
*/
|
||||
index = index + (engineConfiguration->cylindersCount / 2);
|
||||
index = index + (engineConfiguration->specs.cylindersCount / 2);
|
||||
registerInjectionEvent(&enginePins.injectors[index], angle, false PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
}
|
||||
|
@ -300,13 +300,13 @@ static NamedOutputPin * getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_S)
|
|||
return &enginePins.coils[0];
|
||||
break;
|
||||
case IM_WASTED_SPARK: {
|
||||
int wastedIndex = i % (CONFIG(cylindersCount) / 2);
|
||||
int id = getCylinderId(CONFIG(firingOrder), wastedIndex);
|
||||
int wastedIndex = i % (CONFIG(specs.cylindersCount) / 2);
|
||||
int id = getCylinderId(CONFIG(specs.firingOrder), wastedIndex);
|
||||
return &enginePins.coils[ID2INDEX(id)];
|
||||
}
|
||||
break;
|
||||
case IM_INDIVIDUAL_COILS:
|
||||
return &enginePins.coils[ID2INDEX(getCylinderId(CONFIG(firingOrder), i))];
|
||||
return &enginePins.coils[ID2INDEX(getCylinderId(CONFIG(specs.firingOrder), i))];
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -324,8 +324,8 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
|
|||
// todo: move this reset into decoder
|
||||
engine->triggerShape.calculateTriggerSynchPoint(engineConfiguration, engine);
|
||||
|
||||
for (int i = 0; i < CONFIG(cylindersCount); i++) {
|
||||
ENGINE(angleExtra[i])= (float) CONFIG(engineCycle) * i / CONFIG(cylindersCount);
|
||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||
ENGINE(angleExtra[i])= (float) CONFIG(engineCycle) * i / CONFIG(specs.cylindersCount);
|
||||
|
||||
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER);
|
||||
|
||||
|
@ -343,20 +343,20 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
|
|||
|
||||
#endif
|
||||
|
||||
void setFuelRpmBin(engine_configuration_s *engineConfiguration, float l, float r) {
|
||||
setTableBin(engineConfiguration->fuelRpmBins, FUEL_RPM_COUNT, l, r);
|
||||
void setFuelRpmBin(engine_configuration_s *engineConfiguration, float from, float to) {
|
||||
setTableBin(engineConfiguration->fuelRpmBins, FUEL_RPM_COUNT, from, to);
|
||||
}
|
||||
|
||||
void setFuelLoadBin(engine_configuration_s *engineConfiguration, float l, float r) {
|
||||
setTableBin(engineConfiguration->fuelLoadBins, FUEL_LOAD_COUNT, l, r);
|
||||
void setFuelLoadBin(engine_configuration_s *engineConfiguration, float from, float to) {
|
||||
setTableBin(engineConfiguration->fuelLoadBins, FUEL_LOAD_COUNT, from, to);
|
||||
}
|
||||
|
||||
void setTimingRpmBin(engine_configuration_s *engineConfiguration, float l, float r) {
|
||||
setTableBin(engineConfiguration->ignitionRpmBins, IGN_RPM_COUNT, l, r);
|
||||
void setTimingRpmBin(engine_configuration_s *engineConfiguration, float from, float to) {
|
||||
setTableBin(engineConfiguration->ignitionRpmBins, IGN_RPM_COUNT, from, to);
|
||||
}
|
||||
|
||||
void setTimingLoadBin(engine_configuration_s *engineConfiguration, float l, float r) {
|
||||
setTableBin(engineConfiguration->ignitionLoadBins, IGN_LOAD_COUNT, l, r);
|
||||
void setTimingLoadBin(engine_configuration_s *engineConfiguration, float from, float to) {
|
||||
setTableBin(engineConfiguration->ignitionLoadBins, IGN_LOAD_COUNT, from, to);
|
||||
}
|
||||
|
||||
int isInjectionEnabled(engine_configuration_s *engineConfiguration) {
|
||||
|
|
|
@ -63,10 +63,10 @@ float getSparkDwellMsT(int rpm DECLARE_ENGINE_PARAMETER_S);
|
|||
|
||||
int getCylinderId(firing_order_e firingOrder, int index);
|
||||
|
||||
void setFuelRpmBin(engine_configuration_s *engineConfiguration, float l, float r);
|
||||
void setFuelLoadBin(engine_configuration_s *engineConfiguration, float l, float r);
|
||||
void setTimingRpmBin(engine_configuration_s *engineConfiguration, float l, float r);
|
||||
void setTimingLoadBin(engine_configuration_s *engineConfiguration, float l, float r);
|
||||
void setFuelRpmBin(engine_configuration_s *engineConfiguration, float from, float to);
|
||||
void setFuelLoadBin(engine_configuration_s *engineConfiguration, float from, float to);
|
||||
void setTimingRpmBin(engine_configuration_s *engineConfiguration, float from, float to);
|
||||
void setTimingLoadBin(engine_configuration_s *engineConfiguration, float from, float to);
|
||||
|
||||
void setSingleCoilDwell(engine_configuration_s *engineConfiguration);
|
||||
|
||||
|
|
|
@ -53,9 +53,10 @@ float sdMath(engine_configuration_s *engineConfiguration, float VE, float MAP, f
|
|||
return 0;
|
||||
}
|
||||
|
||||
// todo: pre-calculate gramm/second injector flow to save one multiplication
|
||||
float injectorFlowRate = cc_minute_to_gramm_second(engineConfiguration->injector.flow);
|
||||
// todo: pre-calculate cylinder displacement to save one division
|
||||
float Vol = engineConfiguration->specs.displacement / engineConfiguration->cylindersCount;
|
||||
float Vol = engineConfiguration->specs.displacement / engineConfiguration->specs.cylindersCount;
|
||||
return (Vol * VE * MAP) / (AFR * injectorFlowRate * GAS_R * tempK);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,13 +68,13 @@ extern board_configuration_s *boardConfiguration;
|
|||
static void printOutputs(engine_configuration_s *engineConfiguration) {
|
||||
// engine_configuration2_s *engineConfiguration2
|
||||
scheduleMsg(&logger, "injectionPins: mode %s", getPin_output_mode_e(boardConfiguration->injectionPinMode));
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
brain_pin_e brainPin = boardConfiguration->injectionPins[i];
|
||||
scheduleMsg(&logger, "injection #%d @ %s", (1 + i), hwPortname(brainPin));
|
||||
}
|
||||
|
||||
scheduleMsg(&logger, "ignitionPins: mode %s", getPin_output_mode_e(boardConfiguration->ignitionPinMode));
|
||||
for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||
brain_pin_e brainPin = boardConfiguration->ignitionPins[i];
|
||||
scheduleMsg(&logger, "ignition #%d @ %s", (1 + i), hwPortname(brainPin));
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ static void setAlgorithm(int value) {
|
|||
}
|
||||
|
||||
static void setFiringOrder(int value) {
|
||||
engineConfiguration->firingOrder = (firing_order_e) value;
|
||||
engineConfiguration->specs.firingOrder = (firing_order_e) value;
|
||||
doPrintConfiguration(engine);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,13 +88,13 @@ static Logging *logger;
|
|||
//#endif
|
||||
|
||||
static void startSimultaniousInjection(Engine *engine) {
|
||||
for (int i = 0; i < engine->engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engine->engineConfiguration->specs.cylindersCount; i++) {
|
||||
turnPinHigh(&enginePins.injectors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void endSimultaniousInjection(Engine *engine) {
|
||||
for (int i = 0; i < engine->engineConfiguration->cylindersCount; i++) {
|
||||
for (int i = 0; i < engine->engineConfiguration->specs.cylindersCount; i++) {
|
||||
turnPinLow(&enginePins.injectors[i]);
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
|||
float maxAllowedDwellAngle = (int)(engineConfiguration->engineCycle / 2); // the cast is about making Coverity happy
|
||||
|
||||
if (engineConfiguration->ignitionMode == IM_ONE_COIL) {
|
||||
maxAllowedDwellAngle = engineConfiguration->engineCycle / engineConfiguration->cylindersCount / 1.1;
|
||||
maxAllowedDwellAngle = engineConfiguration->engineCycle / engineConfiguration->specs.cylindersCount / 1.1;
|
||||
}
|
||||
|
||||
if (engine->dwellAngle > maxAllowedDwellAngle) {
|
||||
|
|
|
@ -156,16 +156,15 @@ float[FUEL_RPM_COUNT] fuelRpmBins;RPM is float and not integer in order to use u
|
|||
|
||||
struct_no_prefix specs_s
|
||||
float displacement;Engine displacement, in liters\nsee also cylindersCount;"L", 1, 0, 0, 1000.0, 2
|
||||
end_struct
|
||||
|
||||
specs_s specs
|
||||
|
||||
custom cylinders_count_t 4 bits, U32, @OFFSET@, [0:3], "INVALID", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "INVALID", "INVALID", "INVALID"
|
||||
cylinders_count_t cylindersCount;
|
||||
|
||||
custom firing_order_e 4 bits, U32, @OFFSET@, [0:2], "One Cylinder", "1-3-4-2", "1-2-4-3", "1-3-2-4", "1-5-3-6-2-4", "1-8-4-3-6-5-7-2", "INVALID", "INVALID"
|
||||
firing_order_e firingOrder;
|
||||
end_struct
|
||||
|
||||
specs_s specs
|
||||
|
||||
int rpmHardLimit;;"rpm", 1, 0, 0, 10000.0, 2
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ void testSpeedDensity(void) {
|
|||
|
||||
// 427 cubic inches, that's a LOT of engine
|
||||
eth.ec->specs.displacement = 6.99728;
|
||||
eth.ec->cylindersCount = 8;
|
||||
eth.ec->specs.cylindersCount = 8;
|
||||
|
||||
eth.ec->injector.flow = gramm_second_to_cc_minute(5.303);
|
||||
|
||||
|
|
Loading…
Reference in New Issue