auto-sync

This commit is contained in:
rusEfi 2015-11-12 12:01:26 -05:00
parent 9b17b963d0
commit 719ef9344b
13 changed files with 36 additions and 30 deletions

View File

@ -17,7 +17,7 @@ EXTERN_ENGINE;
void setSachs(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->specs.displacement = 0.1; // 100cc
engineConfiguration->specs.cylindersCount = 1;
engineConfiguration->engineCycle = 360;
engineConfiguration->engineCycleDuration = 360;
setOperationMode(engineConfiguration, TWO_STROKE);
engineConfiguration->specs.firingOrder = FO_ONE_CYLINDER;

View File

@ -500,7 +500,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->engineChartSize = 400;
#endif
engineConfiguration->engineCycle = 720;
engineConfiguration->engineCycleDuration = 720;
engineConfiguration->primingSquirtDurationMs = 5;

View File

@ -1,4 +1,4 @@
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Wed Nov 11 21:47:19 EST 2015
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Nov 12 10:32:55 EST 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -859,7 +859,7 @@ typedef struct {
* 720 for four-stroke
* offset 416
*/
int engineCycle;
int engineCycleDuration;
/**
* offset 420
*/
@ -1571,4 +1571,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Wed Nov 11 21:47:19 EST 2015
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Nov 12 10:32:55 EST 2015

View File

@ -126,7 +126,7 @@
#define firingOrder_offset 408
#define firingOrder_offset_hex 198
#define cylinderBore_offset 412
#define engineCycle_offset 416
#define engineCycleDuration_offset 416
#define rpmHardLimit_offset 420
#define algorithm_offset 424
#define crankingInjectionMode_offset 428

View File

@ -207,7 +207,7 @@ static void periodicFastCallback(DECLARE_ENGINE_PARAMETER_F) {
angle_t offsetAngle = TRIGGER_SHAPE(eventAngles[CONFIG(mapAveragingSchedulingAtIndex)]);
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
angle_t cylinderOffset = engineConfiguration->engineCycle * i / engineConfiguration->specs.cylindersCount;
angle_t cylinderOffset = engineConfiguration->engineCycleDuration * i / engineConfiguration->specs.cylindersCount;
float cylinderStart = start + cylinderOffset - offsetAngle + tdcPosition();
fixAngle(cylinderStart);
engine->engineState.mapAveragingStart[i] = cylinderStart;

View File

@ -176,14 +176,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(engineCycle) * i / CONFIG(specs.cylindersCount);
+ (float) CONFIG(engineCycleDuration) * 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(engineCycle) * i / CONFIG(specs.cylindersCount);
+ (float) CONFIG(engineCycleDuration) * i / CONFIG(specs.cylindersCount);
/**
* We do not need injector pin here because we will control all injectors
@ -196,7 +196,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(engineCycle) / CONFIG(specs.cylindersCount);
+ i * (float) CONFIG(engineCycleDuration) / CONFIG(specs.cylindersCount);
registerInjectionEvent(index, angle, false PASS_ENGINE_PARAMETER);
if (CONFIG(twoWireBatch)) {
@ -372,13 +372,13 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_F) {
engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2;
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
ENGINE(angleExtra[i])= (float) CONFIG(engineCycle) * i / CONFIG(specs.cylindersCount);
ENGINE(angleExtra[i])= (float) CONFIG(engineCycleDuration) * i / CONFIG(specs.cylindersCount);
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER);
}
for (int angle = 0; angle < CONFIG(engineCycle); angle++) {
for (int angle = 0; angle < CONFIG(engineCycleDuration); angle++) {
if (angle==700) {
is700++;
}

View File

@ -28,14 +28,20 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
* @brief Shifts angle into the [0..720) range for four stroke and [0..360) for two stroke
* I guess this implementation would be faster than 'angle % engineCycle'
*/
#define fixAngle(angle) \
if (CONFIG(engineCycle) == 0) { \
firmwareError("zero engineCycle"); \
} \
while (angle < 0) \
angle += CONFIG(engineCycle); \
while (angle >= CONFIG(engineCycle)) \
angle -= CONFIG(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; \
} \
}
/**
* @return time needed to rotate crankshaft by one degree, in milliseconds.

View File

@ -339,10 +339,10 @@ static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionI
* but we are already re-purposing the output signals, but everything works because we
* are not affecting that space in memory. todo: use two instances of 'ignitionSignals'
*/
float maxAllowedDwellAngle = (int) (engineConfiguration->engineCycle / 2); // the cast is about making Coverity happy
float maxAllowedDwellAngle = (int) (engineConfiguration->engineCycleDuration / 2); // the cast is about making Coverity happy
if (engineConfiguration->ignitionMode == IM_ONE_COIL) {
maxAllowedDwellAngle = engineConfiguration->engineCycle / engineConfiguration->specs.cylindersCount / 1.1;
maxAllowedDwellAngle = engineConfiguration->engineCycleDuration / engineConfiguration->specs.cylindersCount / 1.1;
}
if (engine->engineState.dwellAngle == 0) {

View File

@ -196,7 +196,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
if (diffNt == 0) {
rpmState->setRpmValue(NOISY_RPM);
} else {
int mult = engineConfiguration->engineCycle / 360;
int mult = engineConfiguration->engineCycleDuration / 360;
int rpm = (int) (60 * US2NT(US_PER_SECOND_LL) * mult / diffNt);
rpmState->setRpmValue(rpm > UNREALISTIC_RPM ? NOISY_RPM : rpm);
}

View File

@ -245,7 +245,7 @@ void printAllTriggers() {
engine_configuration_s *engineConfiguration = &pc.engineConfiguration;
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
engineConfiguration->engineCycle = 720;
engineConfiguration->engineCycleDuration = 720;
engineConfiguration->trigger.type = tt;
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;

View File

@ -187,7 +187,7 @@ end_struct
specs_s specs
float cylinderBore;Cylinder diameter, in mm.
int engineCycle;todo:eliminate this?\ntodo:operationMode should be enough\n360 for two-stroke\n720 for four-stroke;"engine cycle", 1, 0, 0, 1000, 0
int engineCycleDuration;todo:eliminate this?\ntodo:operationMode should be enough\n360 for two-stroke\n720 for four-stroke;"engine cycle", 1, 0, 0, 1000, 0
int rpmHardLimit;;"rpm", 1, 0, 0, 20000.0, 2

View File

@ -40,7 +40,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 Wed Nov 11 21:47:19 EST 2015
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Thu Nov 12 10:32:55 EST 2015
pageSize = 15288
page = 1
@ -95,7 +95,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
engineCycle = scalar, S32, 416, "engine cycle", 1, 0, 0, 1000, 0
engineCycleDuration = scalar, S32, 416, "engine cycle", 1, 0, 0, 1000, 0
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"
@ -1110,7 +1110,7 @@ fileVersion = { 20150625 }
dialog = injChars, "Injector Settings", yAxis
field = "Injector Open Time", injector_lag
field = "Injector Flow", injector_flow
field = "Engine Cycle", engineCycle
field = "Engine Cycle", engineCycleDuration
dialog = injIO, "Injector Output", yAxis
field = "injection Pin Mode", injectionPinMode

View File

@ -283,8 +283,8 @@ static void testRpmCalculator(void) {
IgnitionEventList *ilist = &eth.engine.engineConfiguration2->ignitionEvents[0];
assertEqualsM("size", 6, ilist->size);
assertEquals(720, eth.engine.engineConfiguration->engineCycle);
assertEquals(720, eth.ec->engineCycle);
assertEquals(720, eth.engine.engineConfiguration->engineCycleDuration);
assertEquals(720, eth.ec->engineCycleDuration);
efiAssertVoid(eth.engine.engineConfiguration!=NULL, "null config in engine");