auto-sync

This commit is contained in:
rusEfi 2015-02-26 17:09:02 -06:00
parent b1f6e4206a
commit c76d777922
16 changed files with 72 additions and 40 deletions

View File

@ -371,7 +371,7 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat
* set_fsio_setting 0 0.11
*/
engineConfiguration->bc.fsio_setting[0] = 0.2;
#if EFI_HIP_9011 || defined(__DOXYGEN__)
#if EFI_FSIO || defined(__DOXYGEN__)
boardConfiguration->fsio_setting[0] = 0.55;
setFsioExt(engineConfiguration, 0, GPIOE_5, "0 fsio_setting", 400);
#endif

View File

@ -61,6 +61,17 @@ Engine::Engine() {
isRunningPwmTest = false;
isTestMode = false;
isSpinning = false;
adcToVoltageInputDividerCoefficient = NAN;
engineConfiguration = NULL;
engineConfiguration2 = NULL;
engineState.iat = engineState.clt = NAN;
memset(&ignitionPin, 0, sizeof(ignitionPin));
iat.config = NULL;
iat.channel = EFI_ADC_NONE;
clt.config = NULL;
clt.channel = EFI_ADC_NONE;
injectorLagMs = advance = dwellAngle = fuelMs = 0;
clutchDownState = clutchUpState = false;

View File

@ -41,7 +41,8 @@
#include "accel_enrichment.h"
#endif /* EFI_ACCEL_ENRICHMENT */
EXTERN_ENGINE;
EXTERN_ENGINE
;
static Map3D1616 fuelMap;
static Map3D1616 fuelPhaseMap;
@ -52,6 +53,8 @@ extern Map3D1616 afrMap;
* @return total duration of fuel injection per engine cycle, in milliseconds
*/
float getRealMafFuel(float airSpeed, int rpm DECLARE_ENGINE_PARAMETER_S) {
if (rpm == 0)
return 0;
// duration of engine cycle, in hours
float engineCycleDurationHr = 1.0 / 60 / rpm;
@ -102,18 +105,19 @@ static int getNumberOfInjections(engine_configuration_s const *engineConfigurati
}
}
/**
* @returns Length of fuel injection, in milliseconds
*/
float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) {
float theoreticalInjectionLength;
if (isCrankingR(rpm)) {
theoreticalInjectionLength = getCrankingFuel(engine) / getNumberOfInjections(engineConfiguration, engineConfiguration->crankingInjectionMode);
theoreticalInjectionLength = getCrankingFuel(engine)
/ getNumberOfInjections(engineConfiguration, engineConfiguration->crankingInjectionMode);
} else {
float baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER);
float fuelPerCycle = getRunningFuel(baseFuel, rpm PASS_ENGINE_PARAMETER);
theoreticalInjectionLength = fuelPerCycle / getNumberOfInjections(engineConfiguration, engine->engineConfiguration->injectionMode);
theoreticalInjectionLength = fuelPerCycle
/ getNumberOfInjections(engineConfiguration, engine->engineConfiguration->injectionMode);
}
return theoreticalInjectionLength + ENGINE(injectorLagMs);
}
@ -187,8 +191,7 @@ float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, flo
*/
float getCrankingFuel(Engine *engine) {
return getCrankingFuel3(engine->engineConfiguration, getCoolantTemperature(engine),
engine->rpmCalculator.getRevolutionCounterSinceStart()
);
engine->rpmCalculator.getRevolutionCounterSinceStart());
}
#endif
@ -198,12 +201,9 @@ float getCrankingFuel3(engine_configuration_s *engineConfiguration, float coolan
float baseCrankingFuel = engineConfiguration->cranking.baseFuel;
if (cisnan(coolantTemperature))
return baseCrankingFuel;
float durationCoef = interpolate2d(revolutionCounterSinceStart,
engineConfiguration->crankingCycleBins,
float durationCoef = interpolate2d(revolutionCounterSinceStart, engineConfiguration->crankingCycleBins,
engineConfiguration->crankingCycleCoef, CRANKING_CURVE_SIZE);
return interpolate2d(coolantTemperature, engineConfiguration->crankingFuelBins,
engineConfiguration->crankingFuelCoef, CRANKING_CURVE_SIZE)
* baseCrankingFuel
* durationCoef;
engineConfiguration->crankingFuelCoef, CRANKING_CURVE_SIZE) * baseCrankingFuel * durationCoef;
}

View File

@ -27,6 +27,8 @@ EXTERN_ENGINE
IdleValveState::IdleValveState() {
value = DEFAULT_IDLE_DUTY;
timeOfLastIdleChange = 0;
time = 0;
targetRpmRangeLeft = targetRpmRangeRight = 0;
}
void IdleValveState::init(DECLARE_ENGINE_PARAMETER_F) {

View File

@ -12,6 +12,8 @@
MenuTree::MenuTree(MenuItem *root) {
this->root = root;
current = NULL;
linesCount = 0;
topVisible = NULL;
}
void MenuTree::init(MenuItem *first, int linesCount) {
@ -45,38 +47,32 @@ void MenuTree::nextItem(void) {
topVisible = topVisible->next;
}
MenuItem::MenuItem(MenuItem * parent, const char *text, VoidCallback callback) {
lcdLine = LL_STRING;
this->text = text;
init(parent, callback);
MenuItem::MenuItem(MenuItem * parent, const char *text, VoidCallback callback) : MenuItem(parent, LL_STRING, text, callback) {
}
MenuItem::MenuItem(MenuItem * parent, const char *text) {
lcdLine = LL_STRING;
this->text = text;
init(parent, NULL);
MenuItem::MenuItem(MenuItem * parent, const char *text) : MenuItem(parent, LL_STRING, text, NULL) {
}
MenuItem::MenuItem(MenuItem * parent, lcd_line_e lcdLine) {
this->lcdLine = lcdLine;
text = NULL;
topOfTheList = NULL;
init(parent, NULL);
MenuItem::MenuItem(MenuItem * parent, lcd_line_e lcdLine) : MenuItem(parent, lcdLine, NULL, NULL) {
}
void MenuItem::init(MenuItem * parent, VoidCallback callback) {
MenuItem::MenuItem(MenuItem * parent, lcd_line_e lcdLine, const char *text, VoidCallback callback) {
this->parent = parent;
this->lcdLine = lcdLine;
this->text = text;
this->callback = callback;
firstChild = NULL;
lastChild = NULL;
topOfTheList = NULL;
next = NULL;
this->callback = callback;
index = 0;
// root element has NULL parent
if (parent != NULL) {
if (parent->firstChild == NULL) {
parent->firstChild = this;
index = 0;
topOfTheList = this;
parent->firstChild = this;
}
if (parent->lastChild != NULL) {
index = parent->lastChild->index + 1;

View File

@ -42,6 +42,7 @@ typedef void (*VoidCallback)(void);
class MenuItem {
public:
MenuItem(MenuItem * parent, lcd_line_e lcdLine, const char *text, VoidCallback callback);
MenuItem(MenuItem * parent, const char *text, VoidCallback callback);
MenuItem(MenuItem * parent, const char *text);
MenuItem(MenuItem * parent, lcd_line_e lcdLine);
@ -55,8 +56,6 @@ public:
MenuItem *lastChild;
MenuItem *next;
VoidCallback callback;
private:
void init(MenuItem * parent, VoidCallback callback);
};
class MenuTree {

View File

@ -30,12 +30,19 @@ private:
template<int SIZE>
class Table2D {
public:
Table2D();
void preCalc(float *bin, float *values);
float aTable[SIZE];
float bTable[SIZE];
float *bin;
};
template<int SIZE>
Table2D<SIZE>::Table2D() {
bin = NULL;
}
template<int SIZE>
void Table2D<SIZE>::preCalc(float *bin, float *values) {
this->bin = bin;

View File

@ -9,6 +9,9 @@
#if EFI_GPIO
#include "efiGpio.h"
#include "io_pins.h"
#if EFI_PROD_CODE || defined(__DOXYGEN__)
#include "gpio_helper.h"
#endif
pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
@ -16,11 +19,16 @@ pin_output_mode_e OUTPUT_MODE_DEFAULT = OM_DEFAULT;
engine_pins_s enginePins;
NamedOutputPin::NamedOutputPin() : OutputPin() {
name = NULL;
}
OutputPin::OutputPin() {
modePtr = &OUTPUT_MODE_DEFAULT;
#if EFI_PROD_CODE || defined(__DOXYGEN__)
port = NULL;
pin = 0;
currentLogicValue = INITIAL_PIN_STATE;
#endif
}
void OutputPin::setValue(int logicValue) {

View File

@ -24,7 +24,7 @@ public:
void setValue(int logicValue);
void setDefaultPinState(pin_output_mode_e *defaultState);
bool_t getLogicValue();
#if EFI_PROD_CODE
#if EFI_PROD_CODE || defined(__DOXYGEN__)
GPIO_TypeDef *port;
int pin;
#endif /* EFI_PROD_CODE */

View File

@ -28,7 +28,7 @@ PwmConfig::PwmConfig() {
memset(&safe, 0, sizeof(safe));
scheduling.name = "PwmConfig";
periodNt = NAN;
// todo outputPins = NULL;
memset(&outputPins, 0, sizeof(outputPins));
phaseCount = 0;
cycleCallback = NULL;
stateChangeCallback = NULL;

View File

@ -225,7 +225,8 @@ float getCrankshaftAngleNt(uint64_t timeNt DECLARE_ENGINE_PARAMETER_S) {
* compiler is not smart enough to figure out that "A / ( B / C)" could be optimized into
* "A * C / B" in order to replace a slower division with a faster multiplication.
*/
return timeSinceZeroAngleNt / getOneDegreeTimeNt(engine->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F));
int rpm = engine->rpmCalculator.rpm(PASS_ENGINE_PARAMETER_F);
return rpm == 0 ? NAN : timeSinceZeroAngleNt / getOneDegreeTimeNt(rpm);
}
void initRpmCalculator(Engine *engine) {

View File

@ -131,6 +131,11 @@ TriggerState::TriggerState() {
totalRevolutionCounter = 0;
totalTriggerErrorCounter = 0;
orderingErrorCounter = 0;
currentDuration = 0;
curSignal = SHAFT_PRIMARY_DOWN;
prevSignal = SHAFT_PRIMARY_DOWN;
prevCycleDuration = 0;
startOfCycleNt = 0;
resetRunningCounters();
clear();

View File

@ -225,7 +225,8 @@ static void reportWave(Logging *logging, int index) {
appendPrintf(logging, "%s", DELIMETER);
uint32_t offsetUs = getWaveOffset(index);
float oneDegreeUs = getOneDegreeTimeUs(getRpm());
int rpm = getRpm();
float oneDegreeUs = rpm == 0 ? NAN : getOneDegreeTimeUs(rpm);
appendPrintf(logging, "advance%d%s", index, DELIMETER);
float angle = (offsetUs / oneDegreeUs) - tdcPosition();

View File

@ -274,9 +274,9 @@ static char UNUSED_RAM_SIZE[9999];
static char UNUSED_CCM_SIZE[4900] CCM_OPTIONAL;
int getRusEfiVersion(void) {
if (UNUSED_RAM_SIZE == 0)
if (UNUSED_RAM_SIZE[0]== 0)
return 1; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE == 0)
if (UNUSED_CCM_SIZE[0] == 0)
return 1; // this is here to make the compiler happy about the unused array
return 20150226;
}

View File

@ -388,12 +388,13 @@ void initIntermediateLoggingBuffer(void) {
Logging::Logging() {
name = NULL;
buffer = linePointer = NULL;
buffer = NULL;
linePointer = NULL;
bufferSize = 0;
isInitialized = false;
}
Logging::Logging(char const *name, char *buffer, int bufferSize) {
Logging::Logging(char const *name, char *buffer, int bufferSize) : Logging() {
#if ! EFI_UNIT_TEST
initLoggingExt(this, "settings control", buffer, bufferSize);
#endif /* ! EFI_UNIT_TEST */

View File

@ -10,6 +10,7 @@
IntListenerArray::IntListenerArray() {
currentListenersCount = 0;
memset(&args, 0, sizeof(args));
}
void IntListenerArray::registerCallback(VoidInt handler, void *arg) {