auto-sync
This commit is contained in:
parent
f1164af456
commit
5d8bd45a50
|
@ -711,18 +711,21 @@ void prepareShapes(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode) {
|
float getRpmMultiplier(operation_mode_e mode) {
|
||||||
if (mode == FOUR_STROKE_CAM_SENSOR) {
|
if (mode == FOUR_STROKE_CAM_SENSOR) {
|
||||||
engineConfiguration->rpmMultiplier = 0.5;
|
return 0.5;
|
||||||
} else if (mode == FOUR_STROKE_CRANK_SENSOR) {
|
} else if (mode == FOUR_STROKE_CRANK_SENSOR) {
|
||||||
engineConfiguration->rpmMultiplier = 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode) {
|
||||||
|
engineConfiguration->operationMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
operation_mode_e getOperationMode(engine_configuration_s const *engineConfiguration) {
|
operation_mode_e getOperationMode(engine_configuration_s const *engineConfiguration) {
|
||||||
if (engineConfiguration->rpmMultiplier == 1)
|
return engineConfiguration->operationMode;
|
||||||
return FOUR_STROKE_CRANK_SENSOR;
|
|
||||||
return FOUR_STROKE_CAM_SENSOR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration) {
|
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration) {
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
* todo: re-arrange this structure one we have a stable code version
|
* todo: re-arrange this structure one we have a stable code version
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
float getRpmMultiplier(operation_mode_e mode);
|
||||||
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode);
|
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode);
|
||||||
operation_mode_e getOperationMode(engine_configuration_s const *engineConfiguration);
|
operation_mode_e getOperationMode(engine_configuration_s const *engineConfiguration);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated by config_definition.jar on Tue Mar 17 17:32:00 EDT 2015
|
// this section was generated by config_definition.jar on Sun Mar 22 13:03:07 EDT 2015
|
||||||
// begin
|
// begin
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -789,10 +789,9 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
ignition_mode_e ignitionMode;
|
ignition_mode_e ignitionMode;
|
||||||
/**
|
/**
|
||||||
* todo: refactor this, see operation_mode_e
|
|
||||||
* offset 736
|
* offset 736
|
||||||
*/
|
*/
|
||||||
float rpmMultiplier;
|
operation_mode_e operationMode;
|
||||||
/**
|
/**
|
||||||
* offset 740
|
* offset 740
|
||||||
*/
|
*/
|
||||||
|
@ -1185,4 +1184,4 @@ typedef struct {
|
||||||
} engine_configuration_s;
|
} engine_configuration_s;
|
||||||
|
|
||||||
// end
|
// end
|
||||||
// this section was generated by config_definition.jar on Tue Mar 17 17:32:00 EDT 2015
|
// this section was generated by config_definition.jar on Sun Mar 22 13:03:07 EDT 2015
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
#define FLASH_DATA_VERSION 7442
|
#define FLASH_DATA_VERSION 7500
|
||||||
|
|
||||||
void readFromFlash(void);
|
void readFromFlash(void);
|
||||||
void initFlash(Logging *sharedLogger, Engine *engine);
|
void initFlash(Logging *sharedLogger, Engine *engine);
|
||||||
|
|
|
@ -214,8 +214,8 @@ void printConfiguration(engine_configuration_s *engineConfiguration) {
|
||||||
|
|
||||||
// appendMsgPrefix(&logger);
|
// appendMsgPrefix(&logger);
|
||||||
|
|
||||||
scheduleMsg(&logger, "rpmHardLimit: %d/rpmMultiplier=%f", engineConfiguration->rpmHardLimit,
|
scheduleMsg(&logger, "rpmHardLimit: %d/operationMode=%d", engineConfiguration->rpmHardLimit,
|
||||||
engineConfiguration->rpmMultiplier);
|
engineConfiguration->operationMode);
|
||||||
|
|
||||||
scheduleMsg(&logger, "tpsMin: %d/tpsMax: %d", engineConfiguration->tpsMin, engineConfiguration->tpsMax);
|
scheduleMsg(&logger, "tpsMin: %d/tpsMax: %d", engineConfiguration->tpsMin, engineConfiguration->tpsMax);
|
||||||
|
|
||||||
|
@ -353,8 +353,8 @@ static void setAnalogChartMode(int value) {
|
||||||
doPrintConfiguration(engine);
|
doPrintConfiguration(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setRpmMultiplier(int value) {
|
static void setOM(int value) {
|
||||||
engineConfiguration->rpmMultiplier = value;
|
engineConfiguration->operationMode = (operation_mode_e)value;
|
||||||
doPrintConfiguration(engine);
|
doPrintConfiguration(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ void initSettings(engine_configuration_s *engineConfiguration) {
|
||||||
addConsoleActionI("set_idle_pin_mode", setIdlePinMode);
|
addConsoleActionI("set_idle_pin_mode", setIdlePinMode);
|
||||||
addConsoleActionI("set_fuel_pump_pin_mode", setFuelPumpPinMode);
|
addConsoleActionI("set_fuel_pump_pin_mode", setFuelPumpPinMode);
|
||||||
addConsoleActionI("set_malfunction_indicator_pin_mode", setMalfunctionIndicatorPinMode);
|
addConsoleActionI("set_malfunction_indicator_pin_mode", setMalfunctionIndicatorPinMode);
|
||||||
addConsoleActionI("set_rpm_multiplier", setRpmMultiplier);
|
addConsoleActionI("set_operation_mode", setOM);
|
||||||
// todo: start saving values into flash right away?
|
// todo: start saving values into flash right away?
|
||||||
|
|
||||||
addConsoleActionF("set_global_fuel_correction", setGlobalFuelCorrection);
|
addConsoleActionF("set_global_fuel_correction", setGlobalFuelCorrection);
|
||||||
|
|
|
@ -231,7 +231,6 @@ float getEngineCycle(operation_mode_e operationMode) {
|
||||||
return operationMode == TWO_STROKE ? 360 : 720;
|
return operationMode == TWO_STROKE ? 360 : 720;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
|
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount,
|
||||||
operation_mode_e operationMode) {
|
operation_mode_e operationMode) {
|
||||||
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
|
efiAssertVoid(totalTeethCount > 0, "totalTeethCount is zero");
|
||||||
|
@ -250,19 +249,20 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount,
|
||||||
float engineCycle = getEngineCycle(operationMode);
|
float engineCycle = getEngineCycle(operationMode);
|
||||||
|
|
||||||
for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) {
|
for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) {
|
||||||
float angleDown = 720.0 / totalTeethCount * (i + toothWidth);
|
float angleDown = engineCycle / totalTeethCount * (i + toothWidth);
|
||||||
float angleUp = 720.0 / totalTeethCount * (i + 1);
|
float angleUp = engineCycle / totalTeethCount * (i + 1);
|
||||||
s->addEvent(angleDown, T_PRIMARY, TV_HIGH);
|
s->addEvent(angleDown, T_PRIMARY, TV_HIGH);
|
||||||
s->addEvent(angleUp, T_PRIMARY, TV_LOW);
|
s->addEvent(angleUp, T_PRIMARY, TV_LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
float angleDown = 720.0 / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth);
|
float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth);
|
||||||
s->addEvent(angleDown, T_PRIMARY, TV_HIGH);
|
s->addEvent(angleDown, T_PRIMARY, TV_HIGH);
|
||||||
s->addEvent(720, T_PRIMARY, TV_LOW);
|
s->addEvent(engineCycle, T_PRIMARY, TV_LOW);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void configureOnePlusOne(TriggerShape *s) {
|
static void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) {
|
||||||
|
float engineCycle = getEngineCycle(operationMode);
|
||||||
|
|
||||||
s->reset(FOUR_STROKE_CAM_SENSOR, true);
|
s->reset(FOUR_STROKE_CAM_SENSOR, true);
|
||||||
|
|
||||||
s->addEvent(180, T_PRIMARY, TV_HIGH);
|
s->addEvent(180, T_PRIMARY, TV_HIGH);
|
||||||
|
@ -322,7 +322,7 @@ void initializeTriggerShape(Logging *logger, engine_configuration_s const *engin
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TT_ONE_PLUS_ONE:
|
case TT_ONE_PLUS_ONE:
|
||||||
configureOnePlusOne(triggerShape);
|
configureOnePlusOne(triggerShape, engineConfiguration->operationMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TT_MAZDA_SOHC_4:
|
case TT_MAZDA_SOHC_4:
|
||||||
|
|
|
@ -89,6 +89,7 @@ private:
|
||||||
bool thirdWheelState;
|
bool thirdWheelState;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
float getEngineCycle(operation_mode_e operationMode);
|
||||||
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode);
|
void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount, operation_mode_e operationMode);
|
||||||
uint32_t findTriggerZeroEventIndex(TriggerShape * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S);
|
uint32_t findTriggerZeroEventIndex(TriggerShape * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_S);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,8 @@ void setTriggerEmulatorRPM(int rpm, Engine *engine) {
|
||||||
if (rpm == 0) {
|
if (rpm == 0) {
|
||||||
triggerSignal.periodNt = NAN;
|
triggerSignal.periodNt = NAN;
|
||||||
} else {
|
} else {
|
||||||
float gRpm = rpm * engineConfiguration->rpmMultiplier / 60.0; // per minute converted to per second
|
float rpmM = getRpmMultiplier(engineConfiguration->operationMode);
|
||||||
|
float gRpm = rpm * rpmM / 60.0; // per minute converted to per second
|
||||||
triggerSignal.periodNt = US2NT(frequency2periodUs(gRpm));
|
triggerSignal.periodNt = US2NT(frequency2periodUs(gRpm));
|
||||||
}
|
}
|
||||||
#if EFI_WAVE_CHART
|
#if EFI_WAVE_CHART
|
||||||
|
|
|
@ -213,11 +213,13 @@ void TriggerShape::addEvent(float angle, trigger_wheel_e const waveIndex, trigge
|
||||||
state = stateParam;
|
state = stateParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float engineCycle = getEngineCycle(operationMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While '720' value works perfectly it has not much sense for crank sensor-only scenario.
|
* While '720' value works perfectly it has not much sense for crank sensor-only scenario.
|
||||||
* todo: accept angle as a value in the 0..1 range?
|
* todo: accept angle as a value in the 0..1 range?
|
||||||
*/
|
*/
|
||||||
angle /= 720;
|
angle /= engineCycle;
|
||||||
|
|
||||||
expectedEventCount[waveIndex]++;
|
expectedEventCount[waveIndex]++;
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ int canSleepPeriod;;"ms", 1, 0, 0, 1000.0, 2
|
||||||
custom ignition_mode_e 4 bits, U32, @OFFSET@, [0:1], "One coil", "Individual Coils", "Wasted", "INVALID"
|
custom ignition_mode_e 4 bits, U32, @OFFSET@, [0:1], "One coil", "Individual Coils", "Wasted", "INVALID"
|
||||||
ignition_mode_e ignitionMode;
|
ignition_mode_e ignitionMode;
|
||||||
|
|
||||||
float rpmMultiplier;todo: refactor this, see operation_mode_e
|
operation_mode_e operationMode
|
||||||
|
|
||||||
custom display_mode_e 4 bits, U32, @OFFSET@, [0:1], "none", "hd44780", "hd44780 over pcf8574", "INVALID"
|
custom display_mode_e 4 bits, U32, @OFFSET@, [0:1], "none", "hd44780", "hd44780 over pcf8574", "INVALID"
|
||||||
display_mode_e displayMode;
|
display_mode_e displayMode;
|
||||||
|
|
|
@ -30,7 +30,7 @@ void testEngineMath(void) {
|
||||||
Engine * engine = ð.engine;
|
Engine * engine = ð.engine;
|
||||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||||
|
|
||||||
engineConfiguration->rpmMultiplier = 0.5;
|
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||||
|
|
||||||
assertEqualsM("600 RPM", 50, getOneDegreeTimeMs(600) * 180);
|
assertEqualsM("600 RPM", 50, getOneDegreeTimeMs(600) * 180);
|
||||||
assertEqualsM("6000 RPM", 5, getOneDegreeTimeMs(6000) * 180);
|
assertEqualsM("6000 RPM", 5, getOneDegreeTimeMs(6000) * 180);
|
||||||
|
|
Loading…
Reference in New Issue