mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
0ab8210cd2
commit
ead7e3fe24
|
@ -17,7 +17,6 @@ EXTERN_ENGINE;
|
||||||
void setSachs(DECLARE_ENGINE_PARAMETER_F) {
|
void setSachs(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
engineConfiguration->specs.displacement = 0.1; // 100cc
|
engineConfiguration->specs.displacement = 0.1; // 100cc
|
||||||
engineConfiguration->specs.cylindersCount = 1;
|
engineConfiguration->specs.cylindersCount = 1;
|
||||||
engineConfiguration->engineCycleDuration = 360;
|
|
||||||
|
|
||||||
setOperationMode(engineConfiguration, TWO_STROKE);
|
setOperationMode(engineConfiguration, TWO_STROKE);
|
||||||
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;
|
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;
|
||||||
|
|
|
@ -69,6 +69,10 @@ void Engine::addConfigurationListener(configuration_callback_t callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Engine::Engine(persistent_config_s *config) {
|
Engine::Engine(persistent_config_s *config) {
|
||||||
|
/**
|
||||||
|
* it's important for fixAngle() that engineCycle field never has zero
|
||||||
|
*/
|
||||||
|
engineCycle = getEngineCycle(FOUR_STROKE_CRANK_SENSOR);
|
||||||
lastTriggerEventTimeNt = 0;
|
lastTriggerEventTimeNt = 0;
|
||||||
isCylinderCleanupMode = false;
|
isCylinderCleanupMode = false;
|
||||||
engineCycleEventCount = 0;
|
engineCycleEventCount = 0;
|
||||||
|
|
|
@ -209,6 +209,8 @@ public:
|
||||||
*/
|
*/
|
||||||
efitick_t stopEngineRequestTimeNt;
|
efitick_t stopEngineRequestTimeNt;
|
||||||
|
|
||||||
|
angle_t engineCycle;
|
||||||
|
|
||||||
AccelEnrichmemnt engineLoadAccelEnrichment;
|
AccelEnrichmemnt engineLoadAccelEnrichment;
|
||||||
AccelEnrichmemnt tpsAccelEnrichment;
|
AccelEnrichmemnt tpsAccelEnrichment;
|
||||||
|
|
||||||
|
|
|
@ -533,8 +533,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
engineConfiguration->engineChartSize = 400;
|
engineConfiguration->engineChartSize = 400;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
engineConfiguration->engineCycleDuration = 720;
|
|
||||||
|
|
||||||
engineConfiguration->primingSquirtDurationMs = 5;
|
engineConfiguration->primingSquirtDurationMs = 5;
|
||||||
|
|
||||||
engineConfiguration->isInjectionEnabled = true;
|
engineConfiguration->isInjectionEnabled = true;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 07 13:56:04 EST 2016
|
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
|
||||||
// begin
|
// begin
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -852,13 +852,9 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
float cylinderBore;
|
float cylinderBore;
|
||||||
/**
|
/**
|
||||||
* todo:see getEngineCycle(operation_mode_e operationMode) eliminate this?
|
|
||||||
* todo:operationMode should be enough
|
|
||||||
* 360 for two-stroke
|
|
||||||
* 720 for four-stroke
|
|
||||||
* offset 416
|
* offset 416
|
||||||
*/
|
*/
|
||||||
int engineCycleDuration;
|
int unused34234;
|
||||||
/**
|
/**
|
||||||
* offset 420
|
* offset 420
|
||||||
*/
|
*/
|
||||||
|
@ -1612,4 +1608,4 @@ typedef struct {
|
||||||
} persistent_config_s;
|
} persistent_config_s;
|
||||||
|
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 07 13:56:04 EST 2016
|
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
#define firingOrder_offset 408
|
#define firingOrder_offset 408
|
||||||
#define firingOrder_offset_hex 198
|
#define firingOrder_offset_hex 198
|
||||||
#define cylinderBore_offset 412
|
#define cylinderBore_offset 412
|
||||||
#define engineCycleDuration_offset 416
|
#define unused34234_offset 416
|
||||||
#define rpmHardLimit_offset 420
|
#define rpmHardLimit_offset 420
|
||||||
#define algorithm_offset 424
|
#define algorithm_offset 424
|
||||||
#define crankingInjectionMode_offset 428
|
#define crankingInjectionMode_offset 428
|
||||||
|
|
|
@ -169,7 +169,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
||||||
* injection phase is scheduled by injection end, so we need to step the angle back
|
* injection phase is scheduled by injection end, so we need to step the angle back
|
||||||
* for the duration of the injection
|
* for the duration of the injection
|
||||||
*/
|
*/
|
||||||
float baseAngle = ENGINE(engineState.injectionOffset)
|
angle_t baseAngle = ENGINE(engineState.injectionOffset)
|
||||||
+ CONFIG(injectionOffset) - MS2US(ENGINE(fuelMs)) / ENGINE(rpmCalculator.oneDegreeUs);
|
+ CONFIG(injectionOffset) - MS2US(ENGINE(fuelMs)) / ENGINE(rpmCalculator.oneDegreeUs);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -177,14 +177,14 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
||||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||||
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
|
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
|
||||||
float angle = baseAngle
|
float angle = baseAngle
|
||||||
+ (float) CONFIG(engineCycleDuration) * i / CONFIG(specs.cylindersCount);
|
+ ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
|
||||||
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
|
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IM_SIMULTANEOUS:
|
case IM_SIMULTANEOUS:
|
||||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||||
float angle = baseAngle
|
float angle = baseAngle
|
||||||
+ (float) CONFIG(engineCycleDuration) * i / CONFIG(specs.cylindersCount);
|
+ ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -197,7 +197,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
||||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||||
int index = i % (engineConfiguration->specs.cylindersCount / 2);
|
int index = i % (engineConfiguration->specs.cylindersCount / 2);
|
||||||
float angle = baseAngle
|
float angle = baseAngle
|
||||||
+ i * (float) CONFIG(engineCycleDuration) / CONFIG(specs.cylindersCount);
|
+ i * ENGINE(engineCycle) / CONFIG(specs.cylindersCount);
|
||||||
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
|
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
|
||||||
|
|
||||||
if (CONFIG(twoWireBatchInjection)) {
|
if (CONFIG(twoWireBatchInjection)) {
|
||||||
|
@ -368,22 +368,23 @@ static NamedOutputPin * getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_S
|
||||||
|
|
||||||
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
|
||||||
|
|
||||||
int is700 = 0;
|
/**
|
||||||
|
* This heavy method is only invoked in case of a configuration change or initialization.
|
||||||
|
*/
|
||||||
void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
|
void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
|
ENGINE(engineCycle) = getEngineCycle(CONFIG(operationMode));
|
||||||
|
|
||||||
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
|
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
|
||||||
|
|
||||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||||
ENGINE(angleExtra[i])= (float) CONFIG(engineCycleDuration) * i / CONFIG(specs.cylindersCount);
|
ENGINE(angleExtra[i])= ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
|
||||||
|
|
||||||
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER);
|
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int angle = 0; angle < CONFIG(engineCycleDuration); angle++) {
|
int engineCycleInt = (int) ENGINE(engineCycle);
|
||||||
if (angle==700) {
|
for (int angle = 0; angle < engineCycleInt; angle++) {
|
||||||
is700++;
|
|
||||||
}
|
|
||||||
int triggerShapeIndex = findAngleIndex(angle PASS_ENGINE_PARAMETER);
|
int triggerShapeIndex = findAngleIndex(angle PASS_ENGINE_PARAMETER);
|
||||||
if (engineConfiguration->useOnlyFrontForTrigger)
|
if (engineConfiguration->useOnlyFrontForTrigger)
|
||||||
triggerShapeIndex = triggerShapeIndex & 0xFFFFFFFE; // we need even index for front_only
|
triggerShapeIndex = triggerShapeIndex & 0xFFFFFFFE; // we need even index for front_only
|
||||||
|
|
|
@ -29,18 +29,15 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
||||||
* I guess this implementation would be faster than 'angle % engineCycle'
|
* I guess this implementation would be faster than 'angle % engineCycle'
|
||||||
*/
|
*/
|
||||||
#define fixAngle(angle) \
|
#define fixAngle(angle) \
|
||||||
{ \
|
{ \
|
||||||
float engineCycleDurationLocalCopy = CONFIG(engineCycleDuration); \
|
float engineCycleDurationLocalCopy = ENGINE(engineCycle); \
|
||||||
/* \
|
/* todo: split this method into 'fixAngleUp' and 'fixAngleDown'*/ \
|
||||||
* could be zero if the middle of setDefaultConfiguration \
|
/* as a performance optimization?*/ \
|
||||||
* todo: anything else should be done to handle this condition? \
|
while (angle < 0) \
|
||||||
*/ \
|
angle += engineCycleDurationLocalCopy; \
|
||||||
if (engineCycleDurationLocalCopy != 0) { \
|
/* todo: would 'if' work as good as 'while'? */ \
|
||||||
while (angle < 0) \
|
while (angle >= engineCycleDurationLocalCopy) \
|
||||||
angle += engineCycleDurationLocalCopy; \
|
angle -= engineCycleDurationLocalCopy; \
|
||||||
while (angle >= engineCycleDurationLocalCopy) \
|
|
||||||
angle -= engineCycleDurationLocalCopy; \
|
|
||||||
} \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -248,7 +248,6 @@ void printAllTriggers() {
|
||||||
engine_configuration_s *engineConfiguration = &pc.engineConfiguration;
|
engine_configuration_s *engineConfiguration = &pc.engineConfiguration;
|
||||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||||
|
|
||||||
engineConfiguration->engineCycleDuration = 720;
|
|
||||||
engineConfiguration->trigger.type = tt;
|
engineConfiguration->trigger.type = tt;
|
||||||
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float getEngineCycle(operation_mode_e operationMode) {
|
angle_t getEngineCycle(operation_mode_e operationMode) {
|
||||||
return operationMode == TWO_STROKE ? 360 : 720;
|
return operationMode == TWO_STROKE ? 360 : 720;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ private:
|
||||||
efitick_t startOfCycleNt;
|
efitick_t startOfCycleNt;
|
||||||
};
|
};
|
||||||
|
|
||||||
float getEngineCycle(operation_mode_e operationMode);
|
angle_t getEngineCycle(operation_mode_e operationMode);
|
||||||
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s,
|
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s,
|
||||||
int totalTeethCount, int skippedCount,
|
int totalTeethCount, int skippedCount,
|
||||||
float toothWidth,
|
float toothWidth,
|
||||||
|
|
|
@ -188,8 +188,7 @@ end_struct
|
||||||
|
|
||||||
specs_s specs
|
specs_s specs
|
||||||
float cylinderBore;Cylinder diameter, in mm.
|
float cylinderBore;Cylinder diameter, in mm.
|
||||||
int engineCycleDuration;todo:see getEngineCycle(operation_mode_e operationMode) eliminate this?\ntodo:operationMode should be enough\n360 for two-stroke\n720 for four-stroke;"engine cycle", 1, 0, 0, 1000, 0
|
int unused34234;
|
||||||
|
|
||||||
int rpmHardLimit;;"rpm", 1, 0, 0, 20000.0, 2
|
int rpmHardLimit;;"rpm", 1, 0, 0, 20000.0, 2
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -275,5 +275,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 20160104;
|
return 20160114;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ enable2ndByteCanID = false
|
||||||
|
|
||||||
; see PAGE_0_SIZE in C source code
|
; see PAGE_0_SIZE in C source code
|
||||||
; CONFIG_DEFINITION_START
|
; CONFIG_DEFINITION_START
|
||||||
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 07 13:56:04 EST 2016
|
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Jan 14 23:21:45 EST 2016
|
||||||
|
|
||||||
pageSize = 16088
|
pageSize = 16088
|
||||||
page = 1
|
page = 1
|
||||||
|
@ -96,7 +96,7 @@ page = 1
|
||||||
cylindersCount = bits, U32, 404, [0:3], "INVALID", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "INVALID", "INVALID", "INVALID"
|
cylindersCount = bits, U32, 404, [0:3], "INVALID", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "INVALID", "INVALID", "INVALID"
|
||||||
firingOrder = bits, U32, 408, [0:3], "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", "1-5-3-6-2-4", "1-4-2-5-3-6", "1-2", "1_2_3_4_5_6", "1-2-3", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
firingOrder = bits, U32, 408, [0:3], "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", "1-5-3-6-2-4", "1-4-2-5-3-6", "1-2", "1_2_3_4_5_6", "1-2-3", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
|
||||||
;skipping cylinderBore offset 412
|
;skipping cylinderBore offset 412
|
||||||
engineCycleDuration = scalar, S32, 416, "engine cycle", 1, 0, 0, 1000, 0
|
;skipping unused34234 offset 416
|
||||||
rpmHardLimit = scalar, S32, 420, "rpm", 1, 0, 0, 20000.0, 2
|
rpmHardLimit = scalar, S32, 420, "rpm", 1, 0, 0, 20000.0, 2
|
||||||
algorithm = bits, U32, 424, [0:1], "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY"
|
algorithm = bits, U32, 424, [0:1], "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY"
|
||||||
crankingInjectionMode = bits, U32, 428, [0:1], "Simultaneous", "Sequential", "Batch", "INVALID"
|
crankingInjectionMode = bits, U32, 428, [0:1], "Simultaneous", "Sequential", "Batch", "INVALID"
|
||||||
|
@ -1137,7 +1137,6 @@ fileVersion = { 20151201 }
|
||||||
field = "Injector Open Time", injector_lag
|
field = "Injector Open Time", injector_lag
|
||||||
field = "Injector Flow", injector_flow
|
field = "Injector Flow", injector_flow
|
||||||
field = "phase offset", injectionOffset
|
field = "phase offset", injectionOffset
|
||||||
field = "Engine Cycle", engineCycleDuration
|
|
||||||
|
|
||||||
dialog = injIO, "Injector Output", yAxis
|
dialog = injIO, "Injector Output", yAxis
|
||||||
field = "injection Pin Mode", injectionPinMode
|
field = "injection Pin Mode", injectionPinMode
|
||||||
|
|
|
@ -283,8 +283,7 @@ static void testRpmCalculator(void) {
|
||||||
IgnitionEventList *ilist = ð.engine.engineConfiguration2->ignitionEvents[0];
|
IgnitionEventList *ilist = ð.engine.engineConfiguration2->ignitionEvents[0];
|
||||||
assertEqualsM("size", 6, ilist->size);
|
assertEqualsM("size", 6, ilist->size);
|
||||||
|
|
||||||
assertEquals(720, eth.engine.engineConfiguration->engineCycleDuration);
|
assertEqualsM("engineCycle", 720, eth.engine.engineCycle);
|
||||||
assertEquals(720, eth.ec->engineCycleDuration);
|
|
||||||
|
|
||||||
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");
|
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue