auto-sync

This commit is contained in:
rusEfi 2014-11-14 22:04:21 -06:00
parent b3cbb8bc44
commit 8dec89c34f
6 changed files with 51 additions and 3 deletions

View File

@ -1,6 +1,8 @@
/**
* @file test_engine.cpp
*
* set_engine_type 26
*
* @date Nov 14, 2014
* @author Andrey Belomutskiy, (c) 2012-2014
*/
@ -9,5 +11,29 @@
#include "test_engine.h"
void setTestEngineConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->triggerConfig.triggerType = TT_TOOTHED_WHEEL_60_2;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->ignitionMode = IM_ONE_COIL;
setConstantDwell(engineConfiguration, 3); // 50% duty cycle @ 5000 rpm
board_configuration_s *bc = &engineConfiguration->bc;
bc->malfunctionIndicatorPin = GPIO_UNASSIGNED;
bc->ignitionPins[0] = GPIOC_7; // #1
bc->ignitionPins[1] = GPIO_UNASSIGNED; // #2
bc->ignitionPins[2] = GPIO_UNASSIGNED; // #3
bc->ignitionPins[3] = GPIO_UNASSIGNED; // #4
bc->ignitionPins[4] = GPIO_UNASSIGNED; // #5
bc->ignitionPins[5] = GPIO_UNASSIGNED; // #6
bc->logicAnalyzerPins[0] = GPIO_UNASSIGNED;
bc->logicAnalyzerPins[1] = GPIO_UNASSIGNED;
bc->logicAnalyzerPins[2] = GPIO_UNASSIGNED;
bc->logicAnalyzerPins[3] = GPIO_UNASSIGNED;
engineConfiguration->hasCltSensor = false;
engineConfiguration->hasIatSensor = false;
}

View File

@ -247,6 +247,8 @@ case MAZDA_MIATA_NB:
return "MAZDA_MIATA_NB";
case BMW_E34:
return "BMWe34";
case TEST_ENGINE:
return "TESTENG";
}
return NULL;
}

View File

@ -51,6 +51,7 @@
#include "rover_v8.h"
#include "mitsubishi.h"
#include "subaru.h"
#include "test_engine.h"
//#define TS_DEFAULT_SPEED 115200
#define TS_DEFAULT_SPEED 38400
@ -548,9 +549,11 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *e
case BMW_E34:
setBmwE34(engineConfiguration);
break;
case TEST_ENGINE:
setTestEngineConfiguration(engineConfiguration);
break;
default:
firmwareError("Unexpected engine type: %d", engineType);
}
applyNonPersistentConfiguration(logger, engine);

View File

@ -70,6 +70,8 @@ const char* getConfigurationName(engine_type_e engineType) {
return "MX596";
case BMW_E34:
return "BMWe34";
case TEST_ENGINE:
return "Test";
default:
firmwareError("Unexpected: engineType %d", engineType);
return NULL;

View File

@ -94,7 +94,9 @@ typedef enum {
BMW_E34 = 25,
ET_UNUSED = 26,
TEST_ENGINE = 26,
ET_UNUSED = 27,
Force_4b_engine_type = ENUM_SIZE_HACK,
} engine_type_e;

View File

@ -235,7 +235,8 @@ static ALWAYS_INLINE void handleSparkEvent(uint32_t eventIndex, IgnitionEvent *i
}
}
static ALWAYS_INLINE void handleSpark(uint32_t eventIndex, int rpm, IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
static ALWAYS_INLINE void handleSpark(uint32_t eventIndex, int rpm,
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
if (!isValidRpm(rpm) || !engineConfiguration->isIgnitionEnabled)
return; // this might happen for instance in case of a single trigger event after a pause
@ -348,6 +349,18 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Eng
float dwellAngle = dwellMs / getOneDegreeTimeMs(rpm);
float maxAllowedDwellAngle = engineConfiguration->engineCycle / 2;
if (engineConfiguration->ignitionMode == IM_ONE_COIL) {
maxAllowedDwellAngle = engineConfiguration->engineCycle / engineConfiguration->cylindersCount / 1.1;
}
if (dwellAngle > maxAllowedDwellAngle) {
warning(OBD_PCM_Processor_Fault, "dwell angle too long: %f", dwellAngle);
}
// todo: add some check for dwell overflow? like 4 times 6 ms while engine cycle is less then that
initializeIgnitionActions(fixAngle(-advance PASS_ENGINE_PARAMETER), dwellAngle, engine->engineConfiguration2,
&engine->engineConfiguration2->ignitionEvents[revolutionIndex] PASS_ENGINE_PARAMETER);
}