auto-sync
This commit is contained in:
parent
0ab8210cd2
commit
ead7e3fe24
|
@ -17,7 +17,6 @@ EXTERN_ENGINE;
|
|||
void setSachs(DECLARE_ENGINE_PARAMETER_F) {
|
||||
engineConfiguration->specs.displacement = 0.1; // 100cc
|
||||
engineConfiguration->specs.cylindersCount = 1;
|
||||
engineConfiguration->engineCycleDuration = 360;
|
||||
|
||||
setOperationMode(engineConfiguration, TWO_STROKE);
|
||||
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;
|
||||
|
|
|
@ -69,6 +69,10 @@ void Engine::addConfigurationListener(configuration_callback_t callback) {
|
|||
}
|
||||
|
||||
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;
|
||||
isCylinderCleanupMode = false;
|
||||
engineCycleEventCount = 0;
|
||||
|
|
|
@ -209,6 +209,8 @@ public:
|
|||
*/
|
||||
efitick_t stopEngineRequestTimeNt;
|
||||
|
||||
angle_t engineCycle;
|
||||
|
||||
AccelEnrichmemnt engineLoadAccelEnrichment;
|
||||
AccelEnrichmemnt tpsAccelEnrichment;
|
||||
|
||||
|
|
|
@ -533,8 +533,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->engineChartSize = 400;
|
||||
#endif
|
||||
|
||||
engineConfiguration->engineCycleDuration = 720;
|
||||
|
||||
engineConfiguration->primingSquirtDurationMs = 5;
|
||||
|
||||
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
|
||||
#include "rusefi_types.h"
|
||||
typedef struct {
|
||||
|
@ -852,13 +852,9 @@ typedef struct {
|
|||
*/
|
||||
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
|
||||
*/
|
||||
int engineCycleDuration;
|
||||
int unused34234;
|
||||
/**
|
||||
* offset 420
|
||||
*/
|
||||
|
@ -1612,4 +1608,4 @@ typedef struct {
|
|||
} persistent_config_s;
|
||||
|
||||
// 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_hex 198
|
||||
#define cylinderBore_offset 412
|
||||
#define engineCycleDuration_offset 416
|
||||
#define unused34234_offset 416
|
||||
#define rpmHardLimit_offset 420
|
||||
#define algorithm_offset 424
|
||||
#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
|
||||
* 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);
|
||||
|
||||
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++) {
|
||||
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
|
||||
float angle = baseAngle
|
||||
+ (float) CONFIG(engineCycleDuration) * i / CONFIG(specs.cylindersCount);
|
||||
+ ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
|
||||
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
break;
|
||||
case IM_SIMULTANEOUS:
|
||||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||
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
|
||||
|
@ -197,7 +197,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
|
|||
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
|
||||
int index = i % (engineConfiguration->specs.cylindersCount / 2);
|
||||
float angle = baseAngle
|
||||
+ i * (float) CONFIG(engineCycleDuration) / CONFIG(specs.cylindersCount);
|
||||
+ i * ENGINE(engineCycle) / CONFIG(specs.cylindersCount);
|
||||
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
|
||||
|
||||
if (CONFIG(twoWireBatchInjection)) {
|
||||
|
@ -368,22 +368,23 @@ static NamedOutputPin * getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_S
|
|||
|
||||
#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) {
|
||||
ENGINE(engineCycle) = getEngineCycle(CONFIG(operationMode));
|
||||
|
||||
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
for (int angle = 0; angle < CONFIG(engineCycleDuration); angle++) {
|
||||
if (angle==700) {
|
||||
is700++;
|
||||
}
|
||||
int engineCycleInt = (int) ENGINE(engineCycle);
|
||||
for (int angle = 0; angle < engineCycleInt; angle++) {
|
||||
int triggerShapeIndex = findAngleIndex(angle PASS_ENGINE_PARAMETER);
|
||||
if (engineConfiguration->useOnlyFrontForTrigger)
|
||||
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'
|
||||
*/
|
||||
#define fixAngle(angle) \
|
||||
{ \
|
||||
float engineCycleDurationLocalCopy = CONFIG(engineCycleDuration); \
|
||||
/* \
|
||||
* could be zero if the middle of setDefaultConfiguration \
|
||||
* todo: anything else should be done to handle this condition? \
|
||||
*/ \
|
||||
if (engineCycleDurationLocalCopy != 0) { \
|
||||
while (angle < 0) \
|
||||
angle += engineCycleDurationLocalCopy; \
|
||||
while (angle >= engineCycleDurationLocalCopy) \
|
||||
angle -= engineCycleDurationLocalCopy; \
|
||||
} \
|
||||
{ \
|
||||
float engineCycleDurationLocalCopy = ENGINE(engineCycle); \
|
||||
/* todo: split this method into 'fixAngleUp' and 'fixAngleDown'*/ \
|
||||
/* as a performance optimization?*/ \
|
||||
while (angle < 0) \
|
||||
angle += engineCycleDurationLocalCopy; \
|
||||
/* todo: would 'if' work as good as 'while'? */ \
|
||||
while (angle >= engineCycleDurationLocalCopy) \
|
||||
angle -= engineCycleDurationLocalCopy; \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -248,7 +248,6 @@ void printAllTriggers() {
|
|||
engine_configuration_s *engineConfiguration = &pc.engineConfiguration;
|
||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||
|
||||
engineConfiguration->engineCycleDuration = 720;
|
||||
engineConfiguration->trigger.type = tt;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ private:
|
|||
efitick_t startOfCycleNt;
|
||||
};
|
||||
|
||||
float getEngineCycle(operation_mode_e operationMode);
|
||||
angle_t getEngineCycle(operation_mode_e operationMode);
|
||||
void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s,
|
||||
int totalTeethCount, int skippedCount,
|
||||
float toothWidth,
|
||||
|
|
|
@ -188,8 +188,7 @@ end_struct
|
|||
|
||||
specs_s specs
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -275,5 +275,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
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
|
||||
; 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
|
||||
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"
|
||||
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
|
||||
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
|
||||
algorithm = bits, U32, 424, [0:1], "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY"
|
||||
crankingInjectionMode = bits, U32, 428, [0:1], "Simultaneous", "Sequential", "Batch", "INVALID"
|
||||
|
@ -1137,7 +1137,6 @@ fileVersion = { 20151201 }
|
|||
field = "Injector Open Time", injector_lag
|
||||
field = "Injector Flow", injector_flow
|
||||
field = "phase offset", injectionOffset
|
||||
field = "Engine Cycle", engineCycleDuration
|
||||
|
||||
dialog = injIO, "Injector Output", yAxis
|
||||
field = "injection Pin Mode", injectionPinMode
|
||||
|
|
|
@ -283,8 +283,7 @@ static void testRpmCalculator(void) {
|
|||
IgnitionEventList *ilist = ð.engine.engineConfiguration2->ignitionEvents[0];
|
||||
assertEqualsM("size", 6, ilist->size);
|
||||
|
||||
assertEquals(720, eth.engine.engineConfiguration->engineCycleDuration);
|
||||
assertEquals(720, eth.ec->engineCycleDuration);
|
||||
assertEqualsM("engineCycle", 720, eth.engine.engineCycle);
|
||||
|
||||
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");
|
||||
|
||||
|
|
Loading…
Reference in New Issue