auto-sync
This commit is contained in:
parent
31dbf46578
commit
a538dde81e
|
@ -52,7 +52,7 @@ static const ignition_table_t defaultIatTiming = {
|
||||||
{-4.4, -4.9, -5.9, -5.9, -5.9, -5.9, -4.9, -4.9, -4.9, -4.9, -4.9, -3.9, -3.9, -3.9, -3.9, -3.9},
|
{-4.4, -4.9, -5.9, -5.9, -5.9, -5.9, -4.9, -4.9, -4.9, -4.9, -4.9, -3.9, -3.9, -3.9, -3.9, -3.9},
|
||||||
};
|
};
|
||||||
|
|
||||||
bool_t isStep1Condition(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
bool isStep1Condition(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
return boardConfiguration->enabledStep1Limiter && rpm >= engineConfiguration->step1rpm;
|
return boardConfiguration->enabledStep1Limiter && rpm >= engineConfiguration->step1rpm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ static bool stopPin(NamedOutputPin *output) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t Engine::stopPins() {
|
bool Engine::stopPins() {
|
||||||
bool result = false;
|
bool result = false;
|
||||||
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
|
||||||
result |= stopPin(&enginePins.coils[i]);
|
result |= stopPin(&enginePins.coils[i]);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
int eventsCount;
|
int eventsCount;
|
||||||
private:
|
private:
|
||||||
void clear();
|
void clear();
|
||||||
void registerInjectionEvent(int injectorIndex, float angle, bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S);
|
void registerInjectionEvent(int injectorIndex, float angle, bool isSimultanious DECLARE_ENGINE_PARAMETER_S);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,19 +231,19 @@ public:
|
||||||
void periodicFastCallback(DECLARE_ENGINE_PARAMETER_F);
|
void periodicFastCallback(DECLARE_ENGINE_PARAMETER_F);
|
||||||
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_F);
|
void updateSlowSensors(DECLARE_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
bool_t clutchUpState;
|
bool clutchUpState;
|
||||||
bool_t clutchDownState;
|
bool clutchDownState;
|
||||||
|
|
||||||
bool_t isRunningPwmTest;
|
bool isRunningPwmTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are we experiencing knock right now?
|
* Are we experiencing knock right now?
|
||||||
*/
|
*/
|
||||||
bool_t knockNow;
|
bool knockNow;
|
||||||
/**
|
/**
|
||||||
* Have we experienced knock since engine was started?
|
* Have we experienced knock since engine was started?
|
||||||
*/
|
*/
|
||||||
bool_t knockEver;
|
bool knockEver;
|
||||||
/**
|
/**
|
||||||
* KnockCount is directly proportional to the degrees of ignition
|
* KnockCount is directly proportional to the degrees of ignition
|
||||||
* advance removed
|
* advance removed
|
||||||
|
@ -252,7 +252,7 @@ public:
|
||||||
|
|
||||||
float knockVolts;
|
float knockVolts;
|
||||||
|
|
||||||
bool_t knockDebug;
|
bool knockDebug;
|
||||||
|
|
||||||
efitimeus_t timeOfLastKnockEvent;
|
efitimeus_t timeOfLastKnockEvent;
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public:
|
||||||
* are we running any kind of functional test? this affect
|
* are we running any kind of functional test? this affect
|
||||||
* some areas
|
* some areas
|
||||||
*/
|
*/
|
||||||
bool_t isTestMode;
|
bool isTestMode;
|
||||||
|
|
||||||
TriggerShape triggerShape;
|
TriggerShape triggerShape;
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ public:
|
||||||
* This field is true if we are in 'cylinder cleanup' state right now
|
* This field is true if we are in 'cylinder cleanup' state right now
|
||||||
* see isCylinderCleanupEnabled
|
* see isCylinderCleanupEnabled
|
||||||
*/
|
*/
|
||||||
bool_t isCylinderCleanupMode;
|
bool isCylinderCleanupMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* value of 'triggerShape.getLength()'
|
* value of 'triggerShape.getLength()'
|
||||||
|
@ -339,8 +339,8 @@ private:
|
||||||
* 'running' means RPM are above crankingRpm
|
* 'running' means RPM are above crankingRpm
|
||||||
* 'spinning' means the engine is not stopped
|
* 'spinning' means the engine is not stopped
|
||||||
*/
|
*/
|
||||||
bool_t isSpinning;
|
bool isSpinning;
|
||||||
bool_t stopPins();
|
bool stopPins();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -214,14 +214,14 @@ typedef struct {
|
||||||
trigger_type_e type;
|
trigger_type_e type;
|
||||||
/**
|
/**
|
||||||
offset 4 bit 0 */
|
offset 4 bit 0 */
|
||||||
bool_t customIsSynchronizationNeeded : 1;
|
bool customIsSynchronizationNeeded : 1;
|
||||||
/**
|
/**
|
||||||
offset 4 bit 1 */
|
offset 4 bit 1 */
|
||||||
bool_t customNeedSecondTriggerInput : 1;
|
bool customNeedSecondTriggerInput : 1;
|
||||||
/**
|
/**
|
||||||
* This option could be used if your second trigger channel is broken
|
* This option could be used if your second trigger channel is broken
|
||||||
offset 4 bit 2 */
|
offset 4 bit 2 */
|
||||||
bool_t useOnlyFirstChannel : 1;
|
bool useOnlyFirstChannel : 1;
|
||||||
/**
|
/**
|
||||||
* offset 8
|
* offset 8
|
||||||
*/
|
*/
|
||||||
|
@ -540,43 +540,43 @@ typedef struct {
|
||||||
pin_output_mode_e o2heaterPinModeTodO;
|
pin_output_mode_e o2heaterPinModeTodO;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 0 */
|
offset 384 bit 0 */
|
||||||
bool_t is_enabled_spi_1 : 1;
|
bool is_enabled_spi_1 : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 1 */
|
offset 384 bit 1 */
|
||||||
bool_t is_enabled_spi_2 : 1;
|
bool is_enabled_spi_2 : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 2 */
|
offset 384 bit 2 */
|
||||||
bool_t is_enabled_spi_3 : 1;
|
bool is_enabled_spi_3 : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 3 */
|
offset 384 bit 3 */
|
||||||
bool_t isSdCardEnabled : 1;
|
bool isSdCardEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 4 */
|
offset 384 bit 4 */
|
||||||
bool_t isFastAdcEnabled : 1;
|
bool isFastAdcEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 5 */
|
offset 384 bit 5 */
|
||||||
bool_t isEngineControlEnabled : 1;
|
bool isEngineControlEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 6 */
|
offset 384 bit 6 */
|
||||||
bool_t isHip9011Enabled : 1;
|
bool isHip9011Enabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 7 */
|
offset 384 bit 7 */
|
||||||
bool_t isVerboseAlternator : 1;
|
bool isVerboseAlternator : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 8 */
|
offset 384 bit 8 */
|
||||||
bool_t useSerialPort : 1;
|
bool useSerialPort : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 9 */
|
offset 384 bit 9 */
|
||||||
bool_t useStepperIdle : 1;
|
bool useStepperIdle : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 10 */
|
offset 384 bit 10 */
|
||||||
bool_t enabledStep1Limiter : 1;
|
bool enabledStep1Limiter : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 11 */
|
offset 384 bit 11 */
|
||||||
bool_t useTpicAdvancedMode : 1;
|
bool useTpicAdvancedMode : 1;
|
||||||
/**
|
/**
|
||||||
offset 384 bit 12 */
|
offset 384 bit 12 */
|
||||||
bool_t useLcdScreen : 1;
|
bool useLcdScreen : 1;
|
||||||
/**
|
/**
|
||||||
* offset 388
|
* offset 388
|
||||||
*/
|
*/
|
||||||
|
@ -762,7 +762,7 @@ typedef struct {
|
||||||
* Should the trigger emulator push data right into trigger input, eliminating the need for physical jumper wires?
|
* Should the trigger emulator push data right into trigger input, eliminating the need for physical jumper wires?
|
||||||
* PS: Funny name, right? :)
|
* PS: Funny name, right? :)
|
||||||
offset 80 bit 0 */
|
offset 80 bit 0 */
|
||||||
bool_t directSelfStimulation : 1;
|
bool directSelfStimulation : 1;
|
||||||
/**
|
/**
|
||||||
* todo: extract these two fields into a structure
|
* todo: extract these two fields into a structure
|
||||||
* todo: we need two sets of TPS parameters - modern ETBs have two sensors
|
* todo: we need two sets of TPS parameters - modern ETBs have two sensors
|
||||||
|
@ -1041,68 +1041,68 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* @see isMapAveragingEnabled
|
* @see isMapAveragingEnabled
|
||||||
offset 1496 bit 0 */
|
offset 1496 bit 0 */
|
||||||
bool_t hasMapSensor : 1;
|
bool hasMapSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 1 */
|
offset 1496 bit 1 */
|
||||||
bool_t hasIatSensor : 1;
|
bool hasIatSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 2 */
|
offset 1496 bit 2 */
|
||||||
bool_t hasBaroSensor : 1;
|
bool hasBaroSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 3 */
|
offset 1496 bit 3 */
|
||||||
bool_t hasAfrSensor : 1;
|
bool hasAfrSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 4 */
|
offset 1496 bit 4 */
|
||||||
bool_t useConstantDwellDuringCranking : 1;
|
bool useConstantDwellDuringCranking : 1;
|
||||||
/**
|
/**
|
||||||
* This options enables data for 'engine sniffer' tab in console, which comes at some CPU price
|
* This options enables data for 'engine sniffer' tab in console, which comes at some CPU price
|
||||||
offset 1496 bit 5 */
|
offset 1496 bit 5 */
|
||||||
bool_t isEngineChartEnabled : 1;
|
bool isEngineChartEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 6 */
|
offset 1496 bit 6 */
|
||||||
bool_t isCanEnabled : 1;
|
bool isCanEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 7 */
|
offset 1496 bit 7 */
|
||||||
bool_t hasCltSensor : 1;
|
bool hasCltSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 8 */
|
offset 1496 bit 8 */
|
||||||
bool_t canReadEnabled : 1;
|
bool canReadEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 9 */
|
offset 1496 bit 9 */
|
||||||
bool_t canWriteEnabled : 1;
|
bool canWriteEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 10 */
|
offset 1496 bit 10 */
|
||||||
bool_t hasVehicleSpeedSensor : 1;
|
bool hasVehicleSpeedSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 11 */
|
offset 1496 bit 11 */
|
||||||
bool_t isJoystickEnabled : 1;
|
bool isJoystickEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 12 */
|
offset 1496 bit 12 */
|
||||||
bool_t isGpsEnabled : 1;
|
bool isGpsEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 13 */
|
offset 1496 bit 13 */
|
||||||
bool_t isAlternatorControlEnabled : 1;
|
bool isAlternatorControlEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 14 */
|
offset 1496 bit 14 */
|
||||||
bool_t hasMafSensor : 1;
|
bool hasMafSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 15 */
|
offset 1496 bit 15 */
|
||||||
bool_t hasTpsSensor : 1;
|
bool hasTpsSensor : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 16 */
|
offset 1496 bit 16 */
|
||||||
bool_t cutFuelOnHardLimit : 1;
|
bool cutFuelOnHardLimit : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 17 */
|
offset 1496 bit 17 */
|
||||||
bool_t cutSparkOnHardLimit : 1;
|
bool cutSparkOnHardLimit : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 18 */
|
offset 1496 bit 18 */
|
||||||
bool_t step1fuelCutEnable : 1;
|
bool step1fuelCutEnable : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 19 */
|
offset 1496 bit 19 */
|
||||||
bool_t step1SparkCutEnable : 1;
|
bool step1SparkCutEnable : 1;
|
||||||
/**
|
/**
|
||||||
offset 1496 bit 20 */
|
offset 1496 bit 20 */
|
||||||
bool_t hasFrequencyReportingMapSensor : 1;
|
bool hasFrequencyReportingMapSensor : 1;
|
||||||
/**
|
/**
|
||||||
* offset 1500
|
* offset 1500
|
||||||
*/
|
*/
|
||||||
|
@ -1113,58 +1113,58 @@ typedef struct {
|
||||||
idle_mode_e idleMode;
|
idle_mode_e idleMode;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 0 */
|
offset 1508 bit 0 */
|
||||||
bool_t isInjectionEnabled : 1;
|
bool isInjectionEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 1 */
|
offset 1508 bit 1 */
|
||||||
bool_t isIgnitionEnabled : 1;
|
bool isIgnitionEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 2 */
|
offset 1508 bit 2 */
|
||||||
bool_t isCylinderCleanupEnabled : 1;
|
bool isCylinderCleanupEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 3 */
|
offset 1508 bit 3 */
|
||||||
bool_t secondTriggerChannelEnabled : 1;
|
bool secondTriggerChannelEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 4 */
|
offset 1508 bit 4 */
|
||||||
bool_t needSecondTriggerInputDeprecated : 1;
|
bool needSecondTriggerInputDeprecated : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 5 */
|
offset 1508 bit 5 */
|
||||||
bool_t isMapAveragingEnabled : 1;
|
bool isMapAveragingEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 6 */
|
offset 1508 bit 6 */
|
||||||
bool_t isMilEnabled : 1;
|
bool isMilEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 7 */
|
offset 1508 bit 7 */
|
||||||
bool_t isFuelPumpEnabled : 1;
|
bool isFuelPumpEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 8 */
|
offset 1508 bit 8 */
|
||||||
bool_t isTunerStudioEnabled : 1;
|
bool isTunerStudioEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 9 */
|
offset 1508 bit 9 */
|
||||||
bool_t isWaveAnalyzerEnabled : 1;
|
bool isWaveAnalyzerEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 10 */
|
offset 1508 bit 10 */
|
||||||
bool_t isIdleThreadEnabled : 1;
|
bool isIdleThreadEnabled : 1;
|
||||||
/**
|
/**
|
||||||
offset 1508 bit 11 */
|
offset 1508 bit 11 */
|
||||||
bool_t isPrintTriggerSynchDetails : 1;
|
bool isPrintTriggerSynchDetails : 1;
|
||||||
/**
|
/**
|
||||||
* Usually if we have no trigger events that means engine is stopped
|
* Usually if we have no trigger events that means engine is stopped
|
||||||
* Unless we are troubleshooting and spinning the engine by hand - this case a longer
|
* Unless we are troubleshooting and spinning the engine by hand - this case a longer
|
||||||
* delay is needed
|
* delay is needed
|
||||||
offset 1508 bit 12 */
|
offset 1508 bit 12 */
|
||||||
bool_t isManualSpinningMode : 1;
|
bool isManualSpinningMode : 1;
|
||||||
/**
|
/**
|
||||||
* This is needed if batched injection and individual injector wiring
|
* This is needed if batched injection and individual injector wiring
|
||||||
offset 1508 bit 13 */
|
offset 1508 bit 13 */
|
||||||
bool_t twoWireBatchInjection : 1;
|
bool twoWireBatchInjection : 1;
|
||||||
/**
|
/**
|
||||||
* See #172
|
* See #172
|
||||||
offset 1508 bit 14 */
|
offset 1508 bit 14 */
|
||||||
bool_t useOnlyFrontForTrigger : 1;
|
bool useOnlyFrontForTrigger : 1;
|
||||||
/**
|
/**
|
||||||
* This is needed if batched igniton (waster spark) and individual coil wiring
|
* This is needed if batched igniton (waster spark) and individual coil wiring
|
||||||
offset 1508 bit 15 */
|
offset 1508 bit 15 */
|
||||||
bool_t twoWireBatchIgnition : 1;
|
bool twoWireBatchIgnition : 1;
|
||||||
/**
|
/**
|
||||||
* offset 1512
|
* offset 1512
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
* This is a performance optimization - it's more efficient to handle all
|
* This is a performance optimization - it's more efficient to handle all
|
||||||
* injectors together if that's the case
|
* injectors together if that's the case
|
||||||
*/
|
*/
|
||||||
bool_t isSimultanious;
|
bool isSimultanious;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IgnitionEvent {
|
class IgnitionEvent {
|
||||||
|
|
|
@ -63,7 +63,7 @@ static percent_t setNewValue(IdleValveState *idle, int currentRpm, efitimems_t n
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t isTpsLockout(DECLARE_ENGINE_PARAMETER_F) {
|
bool isTpsLockout(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
// if we have TPS sensor, then use it
|
// if we have TPS sensor, then use it
|
||||||
if (engineConfiguration->hasTpsSensor)
|
if (engineConfiguration->hasTpsSensor)
|
||||||
return getTPS(PASS_ENGINE_PARAMETER_F) > TPS_IDLE_LOCKOUT;
|
return getTPS(PASS_ENGINE_PARAMETER_F) > TPS_IDLE_LOCKOUT;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void removeError(obd_code_e errorCode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setError(bool_t isError, obd_code_e errorCode) {
|
void setError(bool isError, obd_code_e errorCode) {
|
||||||
if (isError)
|
if (isError)
|
||||||
addError(errorCode);
|
addError(errorCode);
|
||||||
else
|
else
|
||||||
|
|
|
@ -41,7 +41,7 @@ void addError(obd_code_e errorCode);
|
||||||
*/
|
*/
|
||||||
void removeError(obd_code_e errorCode);
|
void removeError(obd_code_e errorCode);
|
||||||
|
|
||||||
void setError(bool_t isError, obd_code_e errorCode);
|
void setError(bool isError, obd_code_e errorCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copies the current set of errors into the specified buffer
|
* @brief Copies the current set of errors into the specified buffer
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
void reset();
|
void reset();
|
||||||
T pop();
|
T pop();
|
||||||
T get(int index);
|
T get(int index);
|
||||||
bool_t remove(T value);
|
bool remove(T value);
|
||||||
int size();
|
int size();
|
||||||
bool isEmpty();
|
bool isEmpty();
|
||||||
private:
|
private:
|
||||||
|
@ -45,7 +45,7 @@ void FLStack<T, MAXSIZE>::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, int MAXSIZE>
|
template<typename T, int MAXSIZE>
|
||||||
bool_t FLStack<T, MAXSIZE>::remove(T value) {
|
bool FLStack<T, MAXSIZE>::remove(T value) {
|
||||||
for (int i = 0; i < currentSize; i++) {
|
for (int i = 0; i < currentSize; i++) {
|
||||||
if (values[i] == value) {
|
if (values[i] == value) {
|
||||||
values[0] = values[currentSize - 1];
|
values[0] = values[currentSize - 1];
|
||||||
|
|
|
@ -126,7 +126,7 @@ void LECalculator::push(le_action_e action, float value) {
|
||||||
/**
|
/**
|
||||||
* @return true in case of error, false otherwise
|
* @return true in case of error, false otherwise
|
||||||
*/
|
*/
|
||||||
bool_t LECalculator::doJob(Engine *engine, LEElement *element) {
|
bool LECalculator::doJob(Engine *engine, LEElement *element) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
efiAssert(getRemainingStack(chThdSelf()) > 64, "FSIO logic", false);
|
efiAssert(getRemainingStack(chThdSelf()) > 64, "FSIO logic", false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -278,7 +278,7 @@ float LECalculator::getValue(Engine *engine) {
|
||||||
while (element != NULL) {
|
while (element != NULL) {
|
||||||
efiAssert(counter < 200, "FSIOcount", NAN); // just in case
|
efiAssert(counter < 200, "FSIOcount", NAN); // just in case
|
||||||
|
|
||||||
bool_t isError = doJob(engine, element);
|
bool isError = doJob(engine, element);
|
||||||
if (isError) {
|
if (isError) {
|
||||||
// error already reported
|
// error already reported
|
||||||
return NAN;
|
return NAN;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
int currentCalculationLogPosition;
|
int currentCalculationLogPosition;
|
||||||
private:
|
private:
|
||||||
void push(le_action_e action, float value);
|
void push(le_action_e action, float value);
|
||||||
bool_t doJob(Engine *engine, LEElement *element);
|
bool doJob(Engine *engine, LEElement *element);
|
||||||
float pop(le_action_e action);
|
float pop(le_action_e action);
|
||||||
LEElement *first;
|
LEElement *first;
|
||||||
calc_stack_t stack;
|
calc_stack_t stack;
|
||||||
|
|
|
@ -214,7 +214,7 @@ static void handleFsio(Engine *engine, int index) {
|
||||||
if (boardConfiguration->fsioPins[index] == GPIO_UNASSIGNED)
|
if (boardConfiguration->fsioPins[index] == GPIO_UNASSIGNED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool_t isPwmMode = boardConfiguration->fsioFrequency[index] != NO_PWM;
|
bool isPwmMode = boardConfiguration->fsioFrequency[index] != NO_PWM;
|
||||||
|
|
||||||
float fvalue = calc.getValue2(fsioLogics[index], engine);
|
float fvalue = calc.getValue2(fsioLogics[index], engine);
|
||||||
engine->engineConfiguration2->fsioLastValue[index] = fvalue;
|
engine->engineConfiguration2->fsioLastValue[index] = fvalue;
|
||||||
|
|
|
@ -62,7 +62,7 @@ static float currentEtbDuty;
|
||||||
|
|
||||||
EXTERN_ENGINE;
|
EXTERN_ENGINE;
|
||||||
|
|
||||||
static bool_t wasEtbBraking = false;
|
static bool wasEtbBraking = false;
|
||||||
|
|
||||||
static msg_t etbThread(void *arg) {
|
static msg_t etbThread(void *arg) {
|
||||||
UNUSED(arg);
|
UNUSED(arg);
|
||||||
|
@ -74,7 +74,7 @@ static msg_t etbThread(void *arg) {
|
||||||
|
|
||||||
etbPwmUp.setSimplePwmDutyCycle(currentEtbDuty / 100);
|
etbPwmUp.setSimplePwmDutyCycle(currentEtbDuty / 100);
|
||||||
|
|
||||||
bool_t needEtbBraking = absF(pedal - tps) < 3;
|
bool needEtbBraking = absF(pedal - tps) < 3;
|
||||||
if (needEtbBraking != wasEtbBraking) {
|
if (needEtbBraking != wasEtbBraking) {
|
||||||
scheduleMsg(&logger, "need ETB braking: %d", needEtbBraking);
|
scheduleMsg(&logger, "need ETB braking: %d", needEtbBraking);
|
||||||
wasEtbBraking = needEtbBraking;
|
wasEtbBraking = needEtbBraking;
|
||||||
|
|
|
@ -21,7 +21,7 @@ static LoggingWithStorage logger("error handling");
|
||||||
#define WARNING_PREFIX "WARNING: "
|
#define WARNING_PREFIX "WARNING: "
|
||||||
|
|
||||||
extern int warningEnabled;
|
extern int warningEnabled;
|
||||||
extern bool_t main_loop_started;
|
extern bool main_loop_started;
|
||||||
|
|
||||||
const char *dbg_panic_file;
|
const char *dbg_panic_file;
|
||||||
int dbg_panic_line;
|
int dbg_panic_line;
|
||||||
|
@ -111,7 +111,7 @@ void initErrorHandling(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern VTList vtlist;
|
extern VTList vtlist;
|
||||||
extern bool_t main_loop_started;
|
extern bool main_loop_started;
|
||||||
|
|
||||||
int getVtSizeEstimate(void) {
|
int getVtSizeEstimate(void) {
|
||||||
VirtualTimer *first = vtlist.vt_next;
|
VirtualTimer *first = vtlist.vt_next;
|
||||||
|
|
|
@ -78,7 +78,7 @@ void writeToFlashNow(void) {
|
||||||
efitimems_t nowMs = currentTimeMillis();
|
efitimems_t nowMs = currentTimeMillis();
|
||||||
int result = flashWrite(FLASH_ADDR, (const char *) &persistentState, PERSISTENT_SIZE);
|
int result = flashWrite(FLASH_ADDR, (const char *) &persistentState, PERSISTENT_SIZE);
|
||||||
scheduleMsg(logger, "Flash programmed in %dms", currentTimeMillis() - nowMs);
|
scheduleMsg(logger, "Flash programmed in %dms", currentTimeMillis() - nowMs);
|
||||||
bool_t isSuccess = result == FLASH_RETURN_SUCCESS;
|
bool isSuccess = result == FLASH_RETURN_SUCCESS;
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
scheduleMsg(logger, FLASH_SUCCESS_MSG);
|
scheduleMsg(logger, FLASH_SUCCESS_MSG);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,13 +37,13 @@ static LoggingWithStorage logger("InjectorCentral");
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
|
||||||
static bool_t isRunningBench = false;
|
static bool isRunningBench = false;
|
||||||
|
|
||||||
static int is_injector_enabled[MAX_INJECTOR_COUNT];
|
static int is_injector_enabled[MAX_INJECTOR_COUNT];
|
||||||
|
|
||||||
extern engine_pins_s enginePins;
|
extern engine_pins_s enginePins;
|
||||||
|
|
||||||
bool_t isRunningBenchTest(void) {
|
bool isRunningBenchTest(void) {
|
||||||
return isRunningBench;
|
return isRunningBench;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ static void runBench(brain_pin_e brainPin, OutputPin *output, float delayMs, flo
|
||||||
isRunningBench = false;
|
isRunningBench = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static volatile bool_t needToRunBench = false;
|
static volatile bool needToRunBench = false;
|
||||||
static float onTime;
|
static float onTime;
|
||||||
static float offTime;
|
static float offTime;
|
||||||
static float delayMs;
|
static float delayMs;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
void fanBench(void);
|
void fanBench(void);
|
||||||
void fuelPumpBench(void);
|
void fuelPumpBench(void);
|
||||||
void initInjectorCentral(void);
|
void initInjectorCentral(void);
|
||||||
bool_t isRunningBenchTest(void);
|
bool isRunningBenchTest(void);
|
||||||
int isInjectorEnabled(int cylinderId);
|
int isInjectorEnabled(int cylinderId);
|
||||||
void assertCylinderId(int cylinderId, const char *msg);
|
void assertCylinderId(int cylinderId, const char *msg);
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ static scheduling_s endTimer[INJECTION_PIN_COUNT][2];
|
||||||
* that's a performance optimization: let's not bother averaging
|
* that's a performance optimization: let's not bother averaging
|
||||||
* if we are outside of of the window
|
* if we are outside of of the window
|
||||||
*/
|
*/
|
||||||
static bool_t isAveraging = false;
|
static bool isAveraging = false;
|
||||||
|
|
||||||
static void startAveraging(void *arg) {
|
static void startAveraging(void *arg) {
|
||||||
(void) arg;
|
(void) arg;
|
||||||
|
|
|
@ -114,7 +114,7 @@ void initializeIgnitionActions(angle_t advance, angle_t dwellAngle,
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle,
|
void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle,
|
||||||
bool_t isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
bool isSimultanious DECLARE_ENGINE_PARAMETER_S) {
|
||||||
|
|
||||||
NamedOutputPin *output = &enginePins.injectors[injectorIndex];
|
NamedOutputPin *output = &enginePins.injectors[injectorIndex];
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* @file hip9011_lookup.cpp
|
* @file hip9011_lookup.cpp
|
||||||
|
* @brief HIP9011-specific table lookups, the other part of implementation is in HIP9011.cpp
|
||||||
*
|
*
|
||||||
* @date Jan 4, 2015
|
* @date Jan 4, 2015
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2016
|
* @author Andrey Belomutskiy, (c) 2012-2016
|
||||||
|
|
|
@ -13,7 +13,7 @@ float getMaf(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return getMafT(engineConfiguration);
|
return getMafT(engineConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t hasMafSensor(DECLARE_ENGINE_PARAMETER_F) {
|
bool hasMafSensor(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return engineConfiguration->hasMafSensor && engineConfiguration->mafAdcChannel != EFI_ADC_NONE;
|
return engineConfiguration->hasMafSensor && engineConfiguration->mafAdcChannel != EFI_ADC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#define getMafT(ec) (getVoltageDivided("maf", ec->mafAdcChannel))
|
#define getMafT(ec) (getVoltageDivided("maf", ec->mafAdcChannel))
|
||||||
float getMaf(void);
|
float getMaf(void);
|
||||||
bool_t hasMafSensor(DECLARE_ENGINE_PARAMETER_F);
|
bool hasMafSensor(DECLARE_ENGINE_PARAMETER_F);
|
||||||
float getRealMaf(DECLARE_ENGINE_PARAMETER_F);
|
float getRealMaf(DECLARE_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
void setBosch0280218037(persistent_config_s *engineConfiguration);
|
void setBosch0280218037(persistent_config_s *engineConfiguration);
|
||||||
|
|
|
@ -124,7 +124,7 @@ float getRawMap(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return getMapByVoltage(voltage PASS_ENGINE_PARAMETER);
|
return getMapByVoltage(voltage PASS_ENGINE_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t hasBaroSensor(DECLARE_ENGINE_PARAMETER_F) {
|
bool hasBaroSensor(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return engineConfiguration->hasBaroSensor && engineConfiguration->baroSensor.hwChannel != EFI_ADC_NONE;
|
return engineConfiguration->hasBaroSensor && engineConfiguration->baroSensor.hwChannel != EFI_ADC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S);
|
||||||
*/
|
*/
|
||||||
float getRawMap(DECLARE_ENGINE_PARAMETER_F);
|
float getRawMap(DECLARE_ENGINE_PARAMETER_F);
|
||||||
float getBaroPressure(DECLARE_ENGINE_PARAMETER_F);
|
float getBaroPressure(DECLARE_ENGINE_PARAMETER_F);
|
||||||
bool_t hasBaroSensor(DECLARE_ENGINE_PARAMETER_F);
|
bool hasBaroSensor(DECLARE_ENGINE_PARAMETER_F);
|
||||||
/**
|
/**
|
||||||
* @return MAP value averaged within a window of measurement
|
* @return MAP value averaged within a window of measurement
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -219,7 +219,7 @@ ThermistorMath::ThermistorMath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermistorMath::init(thermistor_conf_s *config) {
|
void ThermistorMath::init(thermistor_conf_s *config) {
|
||||||
bool_t isSameConfig = memcmp(config, ¤tConfig, sizeof(currentConfig)) == 0;
|
bool isSameConfig = memcmp(config, ¤tConfig, sizeof(currentConfig)) == 0;
|
||||||
if (isSameConfig) {
|
if (isSameConfig) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
|
|
||||||
#define NO_TPS_MAGIC_VALUE 66.611
|
#define NO_TPS_MAGIC_VALUE 66.611
|
||||||
|
|
||||||
bool_t hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_F) {
|
bool hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return engineConfiguration->pedalPositionChannel != EFI_ADC_NONE;
|
return engineConfiguration->pedalPositionChannel != EFI_ADC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "engine_configuration.h"
|
#include "engine_configuration.h"
|
||||||
|
|
||||||
bool_t hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_F);
|
bool hasPedalPositionSensor(DECLARE_ENGINE_PARAMETER_F);
|
||||||
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F);
|
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_F);
|
||||||
/**
|
/**
|
||||||
* Throttle Position Sensor
|
* Throttle Position Sensor
|
||||||
|
|
|
@ -18,7 +18,7 @@ float getVRef(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return getVoltageDivided("vref", engineConfiguration->vRefAdcChannel);
|
return getVoltageDivided("vref", engineConfiguration->vRefAdcChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t hasVBatt(DECLARE_ENGINE_PARAMETER_F) {
|
bool hasVBatt(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return engineConfiguration->vbattAdcChannel != EFI_ADC_NONE;
|
return engineConfiguration->vbattAdcChannel != EFI_ADC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,6 @@
|
||||||
|
|
||||||
float getVRef(DECLARE_ENGINE_PARAMETER_F);
|
float getVRef(DECLARE_ENGINE_PARAMETER_F);
|
||||||
float getVBatt(DECLARE_ENGINE_PARAMETER_F);
|
float getVBatt(DECLARE_ENGINE_PARAMETER_F);
|
||||||
bool_t hasVBatt(DECLARE_ENGINE_PARAMETER_F);
|
bool hasVBatt(DECLARE_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ void Executor::scheduleByTime(scheduling_s *scheduling, efitimeus_t timeUs, schf
|
||||||
// this would guard the queue and disable interrupts
|
// this would guard the queue and disable interrupts
|
||||||
lockAnyContext();
|
lockAnyContext();
|
||||||
}
|
}
|
||||||
bool_t needToResetTimer = queue.insertTask(scheduling, US2NT(timeUs), callback, param);
|
bool needToResetTimer = queue.insertTask(scheduling, US2NT(timeUs), callback, param);
|
||||||
if (!reentrantFlag) {
|
if (!reentrantFlag) {
|
||||||
doExecute();
|
doExecute();
|
||||||
if (needToResetTimer) {
|
if (needToResetTimer) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ OutputPin::OutputPin() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t OutputPin::isInitialized() {
|
bool OutputPin::isInitialized() {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
return port != NULL;
|
return port != NULL;
|
||||||
#else
|
#else
|
||||||
|
@ -47,7 +47,7 @@ void OutputPin::setValue(int logicValue) {
|
||||||
doSetOutputPinValue2(this, logicValue);
|
doSetOutputPinValue2(this, logicValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t OutputPin::getLogicValue() {
|
bool OutputPin::getLogicValue() {
|
||||||
return currentLogicValue;
|
return currentLogicValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
class OutputPin {
|
class OutputPin {
|
||||||
public:
|
public:
|
||||||
OutputPin();
|
OutputPin();
|
||||||
bool_t isInitialized();
|
bool isInitialized();
|
||||||
void setValue(int logicValue);
|
void setValue(int logicValue);
|
||||||
void setDefaultPinState(pin_output_mode_e *defaultState);
|
void setDefaultPinState(pin_output_mode_e *defaultState);
|
||||||
bool_t getLogicValue();
|
bool getLogicValue();
|
||||||
void unregister();
|
void unregister();
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
GPIO_TypeDef *port;
|
GPIO_TypeDef *port;
|
||||||
|
|
|
@ -38,7 +38,7 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) {
|
||||||
/**
|
/**
|
||||||
* @return true if inserted into the head of the list
|
* @return true if inserted into the head of the list
|
||||||
*/
|
*/
|
||||||
bool_t EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) {
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
assertListIsSorted();
|
assertListIsSorted();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* O(size)
|
* O(size)
|
||||||
*/
|
*/
|
||||||
bool_t insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param);
|
bool insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param);
|
||||||
|
|
||||||
int executeAll(efitime_t now);
|
int executeAll(efitime_t now);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
schfunc_t callback;
|
schfunc_t callback;
|
||||||
void *param;
|
void *param;
|
||||||
scheduling_s *next;
|
scheduling_s *next;
|
||||||
bool_t isScheduled;
|
bool isScheduled;
|
||||||
};
|
};
|
||||||
|
|
||||||
void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
|
void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
|
||||||
|
|
|
@ -103,7 +103,7 @@ static void endSimultaniousInjection(Engine *engine) {
|
||||||
|
|
||||||
extern WallFuel wallFuel;
|
extern WallFuel wallFuel;
|
||||||
|
|
||||||
static ALWAYS_INLINE void handleFuelInjectionEvent(bool_t limitedFuel, InjectionEvent *event,
|
static ALWAYS_INLINE void handleFuelInjectionEvent(bool limitedFuel, InjectionEvent *event,
|
||||||
int rpm DECLARE_ENGINE_PARAMETER_S) {
|
int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
/**
|
/**
|
||||||
* todo: this is a bit tricky with batched injection. is it? Does the same
|
* todo: this is a bit tricky with batched injection. is it? Does the same
|
||||||
|
@ -160,7 +160,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(bool_t limitedFuel, Injection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE void handleFuel(bool_t limitedFuel, uint32_t eventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
static ALWAYS_INLINE void handleFuel(bool limitedFuel, uint32_t eventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
if (!isInjectionEnabled(engine->engineConfiguration))
|
if (!isInjectionEnabled(engine->engineConfiguration))
|
||||||
return;
|
return;
|
||||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
|
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
|
||||||
|
@ -192,7 +192,7 @@ static ALWAYS_INLINE void handleFuel(bool_t limitedFuel, uint32_t eventIndex, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE void handleSparkEvent(bool_t limitedSpark, uint32_t eventIndex, IgnitionEvent *iEvent,
|
static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t eventIndex, IgnitionEvent *iEvent,
|
||||||
int rpm DECLARE_ENGINE_PARAMETER_S) {
|
int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
|
|
||||||
float dwellMs = engine->engineState.sparkDwell;
|
float dwellMs = engine->engineState.sparkDwell;
|
||||||
|
@ -261,7 +261,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool_t limitedSpark, uint32_t eventIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE void handleSpark(bool_t limitedSpark, uint32_t eventIndex, int rpm,
|
static ALWAYS_INLINE void handleSpark(bool limitedSpark, uint32_t eventIndex, int rpm,
|
||||||
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
IgnitionEventList *list DECLARE_ENGINE_PARAMETER_S) {
|
||||||
if (!isValidRpm(rpm) || !engineConfiguration->isIgnitionEnabled)
|
if (!isValidRpm(rpm) || !engineConfiguration->isIgnitionEnabled)
|
||||||
return; // this might happen for instance in case of a single trigger event after a pause
|
return; // this might happen for instance in case of a single trigger event after a pause
|
||||||
|
@ -323,7 +323,7 @@ static ALWAYS_INLINE void ignitionMathCalc(int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||||
/**
|
/**
|
||||||
* this field is used as an Expression in IAR debugger
|
* this field is used as an Expression in IAR debugger
|
||||||
*/
|
*/
|
||||||
uint32_t *cyccnt = (uint32_t*) &DWT_CYCCNT;
|
uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionIndex DECLARE_ENGINE_PARAMETER_S) {
|
static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionIndex DECLARE_ENGINE_PARAMETER_S) {
|
||||||
|
@ -407,8 +407,8 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECL
|
||||||
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
|
// TODO: add 'pin shutdown' invocation somewhere - coils might be still open here!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool_t limitedSpark = rpm > engineConfiguration->rpmHardLimit;
|
bool limitedSpark = rpm > engineConfiguration->rpmHardLimit;
|
||||||
bool_t limitedFuel = rpm > engineConfiguration->rpmHardLimit;
|
bool limitedFuel = rpm > engineConfiguration->rpmHardLimit;
|
||||||
if (limitedSpark || limitedFuel) {
|
if (limitedSpark || limitedFuel) {
|
||||||
warning(OBD_PCM_Processor_Fault, "skipping stroke due to rpm=%d", rpm);
|
warning(OBD_PCM_Processor_Fault, "skipping stroke due to rpm=%d", rpm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ bool RpmCalculator::isRunning(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
* note that the result of this subtraction could be negative, that would happen if
|
* note that the result of this subtraction could be negative, that would happen if
|
||||||
* we have a trigger event between the time we've invoked 'getTimeNow' and here
|
* we have a trigger event between the time we've invoked 'getTimeNow' and here
|
||||||
*/
|
*/
|
||||||
bool_t result = nowNt - lastRpmEventTimeNt < US2NT(US_PER_SECOND_LL);
|
bool result = nowNt - lastRpmEventTimeNt < US2NT(US_PER_SECOND_LL);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
notRunnintNow = nowNt;
|
notRunnintNow = nowNt;
|
||||||
notRunningPrev = lastRpmEventTimeNt;
|
notRunningPrev = lastRpmEventTimeNt;
|
||||||
|
|
|
@ -111,12 +111,12 @@ void TriggerCentral::resetCounters() {
|
||||||
|
|
||||||
static char shaft_signal_msg_index[15];
|
static char shaft_signal_msg_index[15];
|
||||||
|
|
||||||
static bool_t isUpEvent[6] = { false, true, false, true, false, true };
|
static bool isUpEvent[6] = { false, true, false, true, false, true };
|
||||||
static const char *eventId[6] = { CRANK1, CRANK1, CRANK2, CRANK2, CRANK3, CRANK3 };
|
static const char *eventId[6] = { CRANK1, CRANK1, CRANK2, CRANK2, CRANK3, CRANK3 };
|
||||||
|
|
||||||
static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, int index DECLARE_ENGINE_PARAMETER_S) {
|
static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, int index DECLARE_ENGINE_PARAMETER_S) {
|
||||||
itoa10(&shaft_signal_msg_index[2], index);
|
itoa10(&shaft_signal_msg_index[2], index);
|
||||||
bool_t isUp = isUpEvent[(int) ckpSignalType];
|
bool isUp = isUpEvent[(int) ckpSignalType];
|
||||||
shaft_signal_msg_index[0] = isUp ? 'u' : 'd';
|
shaft_signal_msg_index[0] = isUp ? 'u' : 'd';
|
||||||
|
|
||||||
addWaveChartEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
addWaveChartEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||||
|
|
|
@ -26,7 +26,7 @@ void initDodgeRam(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void configureNeon2003TriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
|
void configureNeon2003TriggerShape(TriggerShape *s DECLARE_ENGINE_PARAMETER_S) {
|
||||||
bool_t useOnlyPrimary = false;
|
bool useOnlyPrimary = false;
|
||||||
|
|
||||||
s->initialize(FOUR_STROKE_CAM_SENSOR, !useOnlyPrimary);
|
s->initialize(FOUR_STROKE_CAM_SENSOR, !useOnlyPrimary);
|
||||||
s->useRiseEdge = true;
|
s->useRiseEdge = true;
|
||||||
|
|
|
@ -62,16 +62,16 @@ static Logging * logger;
|
||||||
|
|
||||||
efitick_t lastDecodingErrorTime = US2NT(-10000000LL);
|
efitick_t lastDecodingErrorTime = US2NT(-10000000LL);
|
||||||
// the boolean flag is a performance optimization so that complex comparison is avoided if no error
|
// the boolean flag is a performance optimization so that complex comparison is avoided if no error
|
||||||
bool_t someSortOfTriggerError = false;
|
bool someSortOfTriggerError = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TRUE is something is wrong with trigger decoding
|
* @return TRUE is something is wrong with trigger decoding
|
||||||
*/
|
*/
|
||||||
bool_t isTriggerDecoderError(void) {
|
bool isTriggerDecoderError(void) {
|
||||||
return errorDetection.sum(6) > 4;
|
return errorDetection.sum(6) > 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t TriggerState::isValidIndex(DECLARE_ENGINE_PARAMETER_F) {
|
bool TriggerState::isValidIndex(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return currentCycle.current_index < TRIGGER_SHAPE(size);
|
return currentCycle.current_index < TRIGGER_SHAPE(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
currentDuration =
|
currentDuration =
|
||||||
currentDurationLong > 10 * US2NT(US_PER_SECOND_LL) ? 10 * US2NT(US_PER_SECOND_LL) : currentDurationLong;
|
currentDurationLong > 10 * US2NT(US_PER_SECOND_LL) ? 10 * US2NT(US_PER_SECOND_LL) : currentDurationLong;
|
||||||
|
|
||||||
bool_t isPrimary = triggerWheel == T_PRIMARY;
|
bool isPrimary = triggerWheel == T_PRIMARY;
|
||||||
|
|
||||||
if (isLessImportant(signal)) {
|
if (isLessImportant(signal)) {
|
||||||
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
@ -193,7 +193,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool_t isSynchronizationPoint;
|
bool isSynchronizationPoint;
|
||||||
|
|
||||||
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
|
if (TRIGGER_SHAPE(isSynchronizationNeeded)) {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
efitime_t getStartOfRevolutionIndex();
|
efitime_t getStartOfRevolutionIndex();
|
||||||
void decodeTriggerEvent(trigger_event_e const signal, efitime_t nowUs DECLARE_ENGINE_PARAMETER_S);
|
void decodeTriggerEvent(trigger_event_e const signal, efitime_t nowUs DECLARE_ENGINE_PARAMETER_S);
|
||||||
|
|
||||||
bool_t isValidIndex(DECLARE_ENGINE_PARAMETER_F);
|
bool isValidIndex(DECLARE_ENGINE_PARAMETER_F);
|
||||||
float getTriggerDutyCycle(int index);
|
float getTriggerDutyCycle(int index);
|
||||||
TriggerStateCallback cycleCallback;
|
TriggerStateCallback cycleCallback;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class Engine;
|
||||||
void initTriggerDecoder(void);
|
void initTriggerDecoder(void);
|
||||||
void initTriggerDecoderLogger(Logging *sharedLogger);
|
void initTriggerDecoderLogger(Logging *sharedLogger);
|
||||||
|
|
||||||
bool_t isTriggerDecoderError(void);
|
bool isTriggerDecoderError(void);
|
||||||
|
|
||||||
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
|
#define considerEventForGap() (!TRIGGER_SHAPE(useOnlyPrimaryForSync) || isPrimary)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ TriggerEmulatorHelper::TriggerEmulatorHelper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is not the only place where we have 'isUpEvent'. todo: reuse
|
// this is not the only place where we have 'isUpEvent'. todo: reuse
|
||||||
static bool_t isUpEvent[6] = { false, true, false, true, false, true };
|
static bool isUpEvent[6] = { false, true, false, true, false, true };
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
;
|
;
|
||||||
|
@ -46,13 +46,13 @@ static void fireShaftSignal(trigger_event_e signal) {
|
||||||
void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIndex) {
|
void TriggerEmulatorHelper::handleEmulatorCallback(PwmConfig *state, int stateIndex) {
|
||||||
int prevIndex = (stateIndex + state->phaseCount - 1) % state->phaseCount;
|
int prevIndex = (stateIndex + state->phaseCount - 1) % state->phaseCount;
|
||||||
|
|
||||||
bool_t primaryWheelState = state->multiWave.waves[0].pinStates[prevIndex];
|
bool primaryWheelState = state->multiWave.waves[0].pinStates[prevIndex];
|
||||||
int newPrimaryWheelState = state->multiWave.waves[0].pinStates[stateIndex];
|
int newPrimaryWheelState = state->multiWave.waves[0].pinStates[stateIndex];
|
||||||
|
|
||||||
bool_t secondaryWheelState = state->multiWave.waves[1].pinStates[prevIndex];
|
bool secondaryWheelState = state->multiWave.waves[1].pinStates[prevIndex];
|
||||||
int newSecondaryWheelState = state->multiWave.waves[1].pinStates[stateIndex];
|
int newSecondaryWheelState = state->multiWave.waves[1].pinStates[stateIndex];
|
||||||
|
|
||||||
bool_t thirdWheelState = state->multiWave.waves[2].pinStates[prevIndex];
|
bool thirdWheelState = state->multiWave.waves[2].pinStates[prevIndex];
|
||||||
int new3rdWheelState = state->multiWave.waves[2].pinStates[stateIndex];
|
int new3rdWheelState = state->multiWave.waves[2].pinStates[stateIndex];
|
||||||
|
|
||||||
if (primaryWheelState != newPrimaryWheelState) {
|
if (primaryWheelState != newPrimaryWheelState) {
|
||||||
|
|
|
@ -26,14 +26,14 @@ void TriggerStimulatorHelper::nextStep(TriggerState *state, TriggerShape * shape
|
||||||
|
|
||||||
int time = (int) (SIMULATION_CYCLE_PERIOD * (loopIndex + shape->wave.getSwitchTime(stateIndex)));
|
int time = (int) (SIMULATION_CYCLE_PERIOD * (loopIndex + shape->wave.getSwitchTime(stateIndex)));
|
||||||
|
|
||||||
bool_t primaryWheelState = shape->wave.getChannelState(0, prevIndex);
|
bool primaryWheelState = shape->wave.getChannelState(0, prevIndex);
|
||||||
bool_t newPrimaryWheelState = shape->wave.getChannelState(0, stateIndex);
|
bool newPrimaryWheelState = shape->wave.getChannelState(0, stateIndex);
|
||||||
|
|
||||||
bool_t secondaryWheelState = shape->wave.getChannelState(1, prevIndex);
|
bool secondaryWheelState = shape->wave.getChannelState(1, prevIndex);
|
||||||
bool_t newSecondaryWheelState = shape->wave.getChannelState(1, stateIndex);
|
bool newSecondaryWheelState = shape->wave.getChannelState(1, stateIndex);
|
||||||
|
|
||||||
bool_t thirdWheelState = shape->wave.getChannelState(2, prevIndex);
|
bool thirdWheelState = shape->wave.getChannelState(2, prevIndex);
|
||||||
bool_t new3rdWheelState = shape->wave.getChannelState(2, stateIndex);
|
bool new3rdWheelState = shape->wave.getChannelState(2, stateIndex);
|
||||||
|
|
||||||
if (primaryWheelState != newPrimaryWheelState) {
|
if (primaryWheelState != newPrimaryWheelState) {
|
||||||
primaryWheelState = newPrimaryWheelState;
|
primaryWheelState = newPrimaryWheelState;
|
||||||
|
|
|
@ -36,8 +36,8 @@ public:
|
||||||
TriggerShape();
|
TriggerShape();
|
||||||
void initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_S);
|
void initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_S);
|
||||||
|
|
||||||
bool_t isSynchronizationNeeded;
|
bool isSynchronizationNeeded;
|
||||||
bool_t needSecondTriggerInput;
|
bool needSecondTriggerInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* duty cycle for each individual trigger channel
|
* duty cycle for each individual trigger channel
|
||||||
|
@ -83,18 +83,18 @@ public:
|
||||||
* In case of a multi-channel trigger, do we want to sync based on primary channel only?
|
* In case of a multi-channel trigger, do we want to sync based on primary channel only?
|
||||||
* See also gapBothDirections
|
* See also gapBothDirections
|
||||||
*/
|
*/
|
||||||
bool_t useOnlyPrimaryForSync;
|
bool useOnlyPrimaryForSync;
|
||||||
/**
|
/**
|
||||||
* Should we use falls or rises for gap ratio detection?
|
* Should we use falls or rises for gap ratio detection?
|
||||||
* todo: combine this flag with gapBothDirections?
|
* todo: combine this flag with gapBothDirections?
|
||||||
*/
|
*/
|
||||||
bool_t useRiseEdge;
|
bool useRiseEdge;
|
||||||
/**
|
/**
|
||||||
* This is about selecting signal edges within partictular trigger channels.
|
* This is about selecting signal edges within partictular trigger channels.
|
||||||
* Should we measure gaps with both fall and rise signal edges?
|
* Should we measure gaps with both fall and rise signal edges?
|
||||||
* See also useOnlyPrimaryForSync
|
* See also useOnlyPrimaryForSync
|
||||||
*/
|
*/
|
||||||
bool_t gapBothDirections;
|
bool gapBothDirections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used for signal validation
|
* This is used for signal validation
|
||||||
|
@ -124,7 +124,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* This is a pretty questionable option which is considered by 'addEvent' method
|
* This is a pretty questionable option which is considered by 'addEvent' method
|
||||||
*/
|
*/
|
||||||
bool_t invertOnAdd;
|
bool invertOnAdd;
|
||||||
/**
|
/**
|
||||||
* Total count of shaft events per CAM or CRANK shaft revolution.
|
* Total count of shaft events per CAM or CRANK shaft revolution.
|
||||||
* TODO this should be migrated to CRANKshaft revolution, this would go together
|
* TODO this should be migrated to CRANKshaft revolution, this would go together
|
||||||
|
|
Loading…
Reference in New Issue