auto-sync
This commit is contained in:
parent
45340c7713
commit
7c00d9f5f1
|
@ -444,8 +444,9 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER);
|
setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER);
|
||||||
|
|
||||||
boardConfiguration->alternatorControlPin = GPIOD_5;
|
boardConfiguration->alternatorControlPin = GPIOD_5;
|
||||||
// engineConfiguration->alternatorControl.pFactor = 22;
|
engineConfiguration->targetVBatt = 14.5;
|
||||||
engineConfiguration->alternatorControl.pFactor = 55; // looks to work better, maybe time for some iFactor
|
engineConfiguration->alternatorOffset = 20;
|
||||||
|
engineConfiguration->alternatorControl.pFactor = 20; // looks to work better, maybe time for some iFactor
|
||||||
|
|
||||||
// enableFrankensoCan();
|
// enableFrankensoCan();
|
||||||
engineConfiguration->canWriteEnabled = true;
|
engineConfiguration->canWriteEnabled = true;
|
||||||
|
@ -463,6 +464,10 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
engineConfiguration->suckedOffCoef = 0.05;
|
engineConfiguration->suckedOffCoef = 0.05;
|
||||||
engineConfiguration->addedToWallCoef = 0.40;
|
engineConfiguration->addedToWallCoef = 0.40;
|
||||||
|
|
||||||
|
engineConfiguration->tpsAccelEnrichmentMultiplier = 0;
|
||||||
|
engineConfiguration->suckedOffCoef = 0;
|
||||||
|
engineConfiguration->addedToWallCoef = 0;
|
||||||
|
|
||||||
boardConfiguration->isSdCardEnabled = false;
|
boardConfiguration->isSdCardEnabled = false;
|
||||||
boardConfiguration->manIdlePosition = 40; // set_idle_pwm 40
|
boardConfiguration->manIdlePosition = 40; // set_idle_pwm 40
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,9 @@ void setFordAspireEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
// engineConfiguration->iat.adcChannel =
|
// engineConfiguration->iat.adcChannel =
|
||||||
|
|
||||||
engineConfiguration->map.sensor.type = MT_DENSO183;
|
engineConfiguration->map.sensor.type = MT_DENSO183;
|
||||||
|
|
||||||
|
engineConfiguration->engineSnifferRpmThreshold = 13000;
|
||||||
|
engineConfiguration->sensorSnifferRpmThreshold = 13000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_SUPPORT_FORD_ASPIRE */
|
#endif /* EFI_SUPPORT_FORD_ASPIRE */
|
||||||
|
|
|
@ -39,7 +39,6 @@ void setMazda626EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
// chartsize 600
|
// chartsize 600
|
||||||
engineConfiguration->engineChartSize = 600;
|
engineConfiguration->engineChartSize = 600;
|
||||||
|
|
||||||
boardConfiguration->sensorChartMode = SC_TRIGGER;
|
|
||||||
engineConfiguration->sensorChartFrequency = 2;
|
engineConfiguration->sensorChartFrequency = 2;
|
||||||
|
|
||||||
engineConfiguration->injector.flow = 330;
|
engineConfiguration->injector.flow = 330;
|
||||||
|
|
|
@ -92,6 +92,9 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
float deltaTps; // offset 116
|
float deltaTps; // offset 116
|
||||||
int triggerErrorsCounter; // offset 120
|
int triggerErrorsCounter; // offset 120
|
||||||
|
/**
|
||||||
|
* Engine load delta
|
||||||
|
*/
|
||||||
float engineLoadAccelDelta; // offset 124
|
float engineLoadAccelDelta; // offset 124
|
||||||
float tpsAccelFuel; // offset 128
|
float tpsAccelFuel; // offset 128
|
||||||
float baroCorrection;
|
float baroCorrection;
|
||||||
|
@ -111,12 +114,12 @@ typedef struct {
|
||||||
float runningFuel; // 188
|
float runningFuel; // 188
|
||||||
int debugIntField1; // 192
|
int debugIntField1; // 192
|
||||||
float injectorLagMs; // 196
|
float injectorLagMs; // 196
|
||||||
float debugFloatField2;
|
float debugFloatField2; // 200
|
||||||
float debugFloatField3;
|
float debugFloatField3; // 204
|
||||||
float debugFloatField4;
|
float debugFloatField4; // 208
|
||||||
float debugFloatField5;
|
float debugFloatField5; // 212
|
||||||
int debugIntField2;
|
int debugIntField2; // 216
|
||||||
int debugIntField3;
|
int debugIntField3; // 220
|
||||||
int unused3[13];
|
int unused3[13];
|
||||||
} TunerStudioOutputChannels;
|
} TunerStudioOutputChannels;
|
||||||
|
|
||||||
|
|
|
@ -593,7 +593,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
tsOutputChannels->manifoldAirPressure = getMap();
|
tsOutputChannels->manifoldAirPressure = getMap();
|
||||||
tsOutputChannels->engineLoad = engineLoad;
|
tsOutputChannels->engineLoad = engineLoad;
|
||||||
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
|
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
|
||||||
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta();
|
|
||||||
tsOutputChannels->triggerErrorsCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
|
tsOutputChannels->triggerErrorsCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
|
||||||
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
|
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
|
||||||
tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_F) ? getPedalPosition(PASS_ENGINE_PARAMETER_F) : 0;
|
tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_F) ? getPedalPosition(PASS_ENGINE_PARAMETER_F) : 0;
|
||||||
|
@ -607,10 +606,14 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER);
|
tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER);
|
||||||
tsOutputChannels->runningFuel = ENGINE(engineState.runningFuel);
|
tsOutputChannels->runningFuel = ENGINE(engineState.runningFuel);
|
||||||
tsOutputChannels->injectorLagMs = ENGINE(injectorLagMs);
|
tsOutputChannels->injectorLagMs = ENGINE(injectorLagMs);
|
||||||
|
|
||||||
tsOutputChannels->wallFuelAmount = wallFuel.getWallFuel(0);
|
tsOutputChannels->wallFuelAmount = wallFuel.getWallFuel(0);
|
||||||
tsOutputChannels->wallFuelCorrection = engine->wallFuelCorrection;
|
tsOutputChannels->wallFuelCorrection = engine->wallFuelCorrection;
|
||||||
tsOutputChannels->engineLoadAccelDelta = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
|
// TPS acceleration
|
||||||
|
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta();
|
||||||
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
|
tsOutputChannels->tpsAccelFuel = engine->engineState.tpsAccelEnrich;
|
||||||
|
// engine load acceleration
|
||||||
|
tsOutputChannels->engineLoadAccelDelta = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
|
||||||
|
|
||||||
tsOutputChannels->iatCorrection = ENGINE(engineState.iatFuelCorrection);
|
tsOutputChannels->iatCorrection = ENGINE(engineState.iatFuelCorrection);
|
||||||
tsOutputChannels->cltCorrection = ENGINE(engineState.cltFuelCorrection);
|
tsOutputChannels->cltCorrection = ENGINE(engineState.cltFuelCorrection);
|
||||||
|
|
|
@ -59,6 +59,10 @@ int MockAdcState::getMockAdcValue(int hwChannel) {
|
||||||
* See also periodicFastCallback
|
* See also periodicFastCallback
|
||||||
*/
|
*/
|
||||||
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_F) {
|
void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
|
int rpm = rpmCalculator.rpmValue;
|
||||||
|
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
|
||||||
|
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? boardConfiguration->sensorChartMode : SC_OFF;
|
||||||
|
|
||||||
engineState.iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F);
|
engineState.iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_F);
|
||||||
engineState.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_F);
|
engineState.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
|
@ -88,6 +92,8 @@ void Engine::addConfigurationListener(configuration_callback_t callback) {
|
||||||
|
|
||||||
Engine::Engine(persistent_config_s *config) {
|
Engine::Engine(persistent_config_s *config) {
|
||||||
init(config);
|
init(config);
|
||||||
|
isEngineChartEnabled = false;
|
||||||
|
sensorChartMode = SC_OFF;
|
||||||
/**
|
/**
|
||||||
* it's important for fixAngle() that engineCycle field never has zero
|
* it's important for fixAngle() that engineCycle field never has zero
|
||||||
*/
|
*/
|
||||||
|
@ -327,7 +333,11 @@ void Engine::periodicFastCallback(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
|
|
||||||
engineState.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
engineState.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
// prepareFuelSchedule(PASS_ENGINE_PARAMETER_F);
|
engine->m.beforeFuelCalc = GET_TIMESTAMP();
|
||||||
|
ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
|
||||||
|
engine->m.fuelCalcTime = GET_TIMESTAMP() - engine->m.beforeFuelCalc;
|
||||||
|
|
||||||
|
prepareFuelSchedule(PASS_ENGINE_PARAMETER_F);
|
||||||
}
|
}
|
||||||
|
|
||||||
StartupFuelPumping::StartupFuelPumping() {
|
StartupFuelPumping::StartupFuelPumping() {
|
||||||
|
|
|
@ -162,6 +162,9 @@ public:
|
||||||
*/
|
*/
|
||||||
floatms_t runningFuel;
|
floatms_t runningFuel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TPS acceleration: extra fuel amount
|
||||||
|
*/
|
||||||
floatms_t tpsAccelEnrich;
|
floatms_t tpsAccelEnrich;
|
||||||
|
|
||||||
angle_t injectionOffset;
|
angle_t injectionOffset;
|
||||||
|
@ -223,7 +226,14 @@ public:
|
||||||
* That's the list of pending spark firing events
|
* That's the list of pending spark firing events
|
||||||
*/
|
*/
|
||||||
IgnitionEvent *iHead;
|
IgnitionEvent *iHead;
|
||||||
|
/**
|
||||||
|
* this is based on isEngineChartEnabled and engineSnifferRpmThreshold settings
|
||||||
|
*/
|
||||||
|
bool isEngineChartEnabled;
|
||||||
|
/**
|
||||||
|
* this is based on sensorChartMode and sensorSnifferRpmThreshold settings
|
||||||
|
*/
|
||||||
|
sensor_chart_e sensorChartMode;
|
||||||
|
|
||||||
RpmCalculator rpmCalculator;
|
RpmCalculator rpmCalculator;
|
||||||
persistent_config_s *config;
|
persistent_config_s *config;
|
||||||
|
@ -235,6 +245,9 @@ public:
|
||||||
*/
|
*/
|
||||||
efitick_t stopEngineRequestTimeNt;
|
efitick_t stopEngineRequestTimeNt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* always 360 or 720, never zero
|
||||||
|
*/
|
||||||
angle_t engineCycle;
|
angle_t engineCycle;
|
||||||
|
|
||||||
AccelEnrichmemnt engineLoadAccelEnrichment;
|
AccelEnrichmemnt engineLoadAccelEnrichment;
|
||||||
|
|
|
@ -382,6 +382,9 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
engineConfiguration->step1SparkCutEnable = false;
|
engineConfiguration->step1SparkCutEnable = false;
|
||||||
engineConfiguration->step1RpmWindow = 500;
|
engineConfiguration->step1RpmWindow = 500;
|
||||||
|
|
||||||
|
engineConfiguration->slowAdcAlpha = 1;
|
||||||
|
engineConfiguration->engineSnifferRpmThreshold = 2500;
|
||||||
|
engineConfiguration->sensorSnifferRpmThreshold = 2500;
|
||||||
engineConfiguration->rpmHardLimit = 7000;
|
engineConfiguration->rpmHardLimit = 7000;
|
||||||
engineConfiguration->cranking.rpm = 550;
|
engineConfiguration->cranking.rpm = 550;
|
||||||
engineConfiguration->cutFuelOnHardLimit = true;
|
engineConfiguration->cutFuelOnHardLimit = true;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 22 21:25:54 EST 2016
|
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016
|
||||||
// begin
|
// begin
|
||||||
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
|
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
|
||||||
#define ENGINE_CONFIGURATION_GENERATED_H_
|
#define ENGINE_CONFIGURATION_GENERATED_H_
|
||||||
|
@ -753,9 +753,10 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
engine_type_e engineType;
|
engine_type_e engineType;
|
||||||
/**
|
/**
|
||||||
|
* Disable engine sniffer above this rpm
|
||||||
* offset 4
|
* offset 4
|
||||||
*/
|
*/
|
||||||
int unusedOffset4;
|
int engineSnifferRpmThreshold;
|
||||||
/**
|
/**
|
||||||
* offset 8
|
* offset 8
|
||||||
*/
|
*/
|
||||||
|
@ -854,9 +855,10 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
float cylinderBore;
|
float cylinderBore;
|
||||||
/**
|
/**
|
||||||
|
* Disable sensor sniffer above this rpm
|
||||||
* offset 416
|
* offset 416
|
||||||
*/
|
*/
|
||||||
int unused34234;
|
int sensorSnifferRpmThreshold;
|
||||||
/**
|
/**
|
||||||
* offset 420
|
* offset 420
|
||||||
*/
|
*/
|
||||||
|
@ -1461,7 +1463,11 @@ typedef struct {
|
||||||
/**
|
/**
|
||||||
* offset 2240
|
* offset 2240
|
||||||
*/
|
*/
|
||||||
int unused[194];
|
float slowAdcAlpha;
|
||||||
|
/**
|
||||||
|
* offset 2244
|
||||||
|
*/
|
||||||
|
int unused[193];
|
||||||
/** total size 3016*/
|
/** total size 3016*/
|
||||||
} engine_configuration_s;
|
} engine_configuration_s;
|
||||||
|
|
||||||
|
@ -1611,4 +1617,4 @@ typedef struct {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 22 21:25:54 EST 2016
|
// this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#define engineConfiguration_offset_hex 0
|
#define engineConfiguration_offset_hex 0
|
||||||
#define engineType_offset 0
|
#define engineType_offset 0
|
||||||
#define engineType_offset_hex 0
|
#define engineType_offset_hex 0
|
||||||
#define unusedOffset4_offset 4
|
#define engineSnifferRpmThreshold_offset 4
|
||||||
#define unusedOffset4_offset_hex 4
|
#define engineSnifferRpmThreshold_offset_hex 4
|
||||||
#define injector_offset 8
|
#define injector_offset 8
|
||||||
#define injector_offset_hex 8
|
#define injector_offset_hex 8
|
||||||
#define injector_flow_offset 8
|
#define injector_flow_offset 8
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
#define firingOrder_offset 408
|
#define firingOrder_offset 408
|
||||||
#define firingOrder_offset_hex 198
|
#define firingOrder_offset_hex 198
|
||||||
#define cylinderBore_offset 412
|
#define cylinderBore_offset 412
|
||||||
#define unused34234_offset 416
|
#define sensorSnifferRpmThreshold_offset 416
|
||||||
#define rpmHardLimit_offset 420
|
#define rpmHardLimit_offset 420
|
||||||
#define algorithm_offset 424
|
#define algorithm_offset 424
|
||||||
#define crankingInjectionMode_offset 428
|
#define crankingInjectionMode_offset 428
|
||||||
|
@ -730,7 +730,8 @@
|
||||||
#define uartConsoleSerialSpeed_offset 2228
|
#define uartConsoleSerialSpeed_offset 2228
|
||||||
#define tpsDecelEnleanmentThreshold_offset 2232
|
#define tpsDecelEnleanmentThreshold_offset 2232
|
||||||
#define tpsDecelEnleanmentMultiplier_offset 2236
|
#define tpsDecelEnleanmentMultiplier_offset 2236
|
||||||
#define unused_offset 2240
|
#define slowAdcAlpha_offset 2240
|
||||||
|
#define unused_offset 2244
|
||||||
#define le_formulas1_offset 3016
|
#define le_formulas1_offset 3016
|
||||||
#define le_formulas2_offset 3216
|
#define le_formulas2_offset 3216
|
||||||
#define le_formulas3_offset 3416
|
#define le_formulas3_offset 3416
|
||||||
|
|
|
@ -73,12 +73,12 @@ void turnPinHigh(NamedOutputPin *output) {
|
||||||
#endif
|
#endif
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
||||||
// explicit check here is a performance optimization to speed up no-chart mode
|
// explicit check here is a performance optimization to speed up no-chart mode
|
||||||
if (CONFIG(isEngineChartEnabled)) {
|
if (ENGINE(isEngineChartEnabled)) {
|
||||||
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
||||||
const char *pinName = output->name;
|
const char *pinName = output->name;
|
||||||
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
||||||
|
|
||||||
addWaveChartEvent(pinName, WC_UP);
|
addEngineSniffferEvent(pinName, WC_UP);
|
||||||
}
|
}
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
|
||||||
|
@ -98,11 +98,11 @@ void turnPinLow(NamedOutputPin *output) {
|
||||||
#endif /* EFI_DEFAILED_LOGGING */
|
#endif /* EFI_DEFAILED_LOGGING */
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
||||||
if (CONFIG(isEngineChartEnabled)) {
|
if (ENGINE(isEngineChartEnabled)) {
|
||||||
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
// this is a performance optimization - array index is cheaper then invoking a method with 'switch'
|
||||||
const char *pinName = output->name;
|
const char *pinName = output->name;
|
||||||
|
|
||||||
addWaveChartEvent(pinName, WC_DOWN);
|
addEngineSniffferEvent(pinName, WC_DOWN);
|
||||||
}
|
}
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ int getRevolutionCounter(void);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayUs, float durationUs, NamedOutputPin *output) {
|
void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayUs, float durationUs, NamedOutputPin *output) {
|
||||||
#if EFI_GPIO
|
#if EFI_GPIO || defined(__DOXYGEN__)
|
||||||
if (durationUs < 0) {
|
if (durationUs < 0) {
|
||||||
warning(OBD_PCM_Processor_Fault, "duration cannot be negative: %d", durationUs);
|
warning(OBD_PCM_Processor_Fault, "duration cannot be negative: %d", durationUs);
|
||||||
return;
|
return;
|
||||||
|
@ -131,6 +131,9 @@ void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayUs, floa
|
||||||
int index = getRevolutionCounter() % 2;
|
int index = getRevolutionCounter() % 2;
|
||||||
scheduling_s * sUp = &signal->signalTimerUp[index];
|
scheduling_s * sUp = &signal->signalTimerUp[index];
|
||||||
scheduling_s * sDown = &signal->signalTimerDown[index];
|
scheduling_s * sDown = &signal->signalTimerDown[index];
|
||||||
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
printf("scheduling output %s\r\n", output->name);
|
||||||
|
#endif
|
||||||
|
|
||||||
scheduleByTime("out up", sUp, nowUs + (int) delayUs, (schfunc_t) &turnPinHigh, output);
|
scheduleByTime("out up", sUp, nowUs + (int) delayUs, (schfunc_t) &turnPinHigh, output);
|
||||||
scheduleByTime("out down", sDown, nowUs + (int) (delayUs + durationUs), (schfunc_t) &turnPinLow, output);
|
scheduleByTime("out down", sDown, nowUs + (int) (delayUs + durationUs), (schfunc_t) &turnPinLow, output);
|
||||||
|
|
|
@ -51,6 +51,7 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
|
||||||
static char warningBuffer[WARNING_BUFFER_SIZE];
|
static char warningBuffer[WARNING_BUFFER_SIZE];
|
||||||
static MemoryStream warningStream;
|
static MemoryStream warningStream;
|
||||||
|
|
||||||
|
static int warningCounter = 0;
|
||||||
/**
|
/**
|
||||||
* OBD_PCM_Processor_Fault is the general error code for now
|
* OBD_PCM_Processor_Fault is the general error code for now
|
||||||
*
|
*
|
||||||
|
@ -64,6 +65,8 @@ int warning(obd_code_e code, const char *fmt, ...) {
|
||||||
return true; // we just had another warning, let's not spam
|
return true; // we just had another warning, let's not spam
|
||||||
timeOfPreviousWarning = now;
|
timeOfPreviousWarning = now;
|
||||||
|
|
||||||
|
warningCounter++;
|
||||||
|
|
||||||
resetLogging(&logger); // todo: is 'reset' really needed here?
|
resetLogging(&logger); // todo: is 'reset' really needed here?
|
||||||
appendMsgPrefix(&logger);
|
appendMsgPrefix(&logger);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
#define FLASH_DATA_VERSION 9000
|
#define FLASH_DATA_VERSION 9052
|
||||||
|
|
||||||
void readFromFlash(void);
|
void readFromFlash(void);
|
||||||
void initFlash(Logging *sharedLogger);
|
void initFlash(Logging *sharedLogger);
|
||||||
|
|
|
@ -108,7 +108,7 @@ static void startAveraging(void *arg) {
|
||||||
* as fast as possible
|
* as fast as possible
|
||||||
*/
|
*/
|
||||||
void mapAveragingCallback(adcsample_t adcValue) {
|
void mapAveragingCallback(adcsample_t adcValue) {
|
||||||
if (!isAveraging && boardConfiguration->sensorChartMode != SC_MAP) {
|
if (!isAveraging && ENGINE(sensorChartMode) != SC_MAP) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void mapAveragingCallback(adcsample_t adcValue) {
|
||||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a");
|
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a");
|
||||||
|
|
||||||
#if (EFI_SENSOR_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__)
|
#if (EFI_SENSOR_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__)
|
||||||
if (boardConfiguration->sensorChartMode == SC_MAP) {
|
if (ENGINE(sensorChartMode) == SC_MAP) {
|
||||||
if (measurementsPerRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR
|
if (measurementsPerRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR
|
||||||
== 0) {
|
== 0) {
|
||||||
float voltage = adcToVoltsDivided(adcValue);
|
float voltage = adcToVoltsDivided(adcValue);
|
||||||
|
|
|
@ -156,6 +156,10 @@ void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle,
|
||||||
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape");
|
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape");
|
||||||
|
|
||||||
findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER);
|
findTriggerPosition(&ev->injectionStart, angle PASS_ENGINE_PARAMETER);
|
||||||
|
#if EFI_UNIT_TEST
|
||||||
|
printf("registerInjectionEvent angle=%f index=%d\r\n", angle, ev->injectionStart.eventIndex);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!hasEvents[ev->injectionStart.eventIndex]) {
|
if (!hasEvents[ev->injectionStart.eventIndex]) {
|
||||||
hasEvents[ev->injectionStart.eventIndex] = true;
|
hasEvents[ev->injectionStart.eventIndex] = true;
|
||||||
eventsCount++;
|
eventsCount++;
|
||||||
|
|
|
@ -319,7 +319,7 @@ void setEngineType(int value) {
|
||||||
resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER);
|
resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER);
|
||||||
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
|
||||||
if (engine->isTestMode)
|
if (engine->isTestMode)
|
||||||
waveChart.resetWaveChart();
|
waveChart.reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_INTERNAL_FLASH
|
||||||
|
|
|
@ -151,6 +151,10 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int eventIndex, bool limitedF
|
||||||
(schfunc_t) &endSimultaniousInjection, engine);
|
(schfunc_t) &endSimultaniousInjection, engine);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
printf("scheduling injection angle=%f/delay=%f injectionDuration=%f\r\n", event->injectionStart.angleOffset, injectionStartDelayUs, injectionDuration);
|
||||||
|
#endif
|
||||||
|
|
||||||
scheduleOutput(signal, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration), event->output);
|
scheduleOutput(signal, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration), event->output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,6 +225,9 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t eventInde
|
||||||
* The start of charge is always within the current trigger event range, so just plain time-based scheduling
|
* The start of charge is always within the current trigger event range, so just plain time-based scheduling
|
||||||
*/
|
*/
|
||||||
if (!limitedSpark) {
|
if (!limitedSpark) {
|
||||||
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
printf("spark charge delay=%f\r\n", chargeDelayUs);
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Note how we do not check if spark is limited or not while scheduling 'spark down'
|
* Note how we do not check if spark is limited or not while scheduling 'spark down'
|
||||||
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
||||||
|
@ -241,6 +248,10 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t eventInde
|
||||||
*/
|
*/
|
||||||
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset;
|
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset;
|
||||||
|
|
||||||
|
#if EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
|
printf("spark delay=%f angle=%f\r\n", timeTillIgnitionUs, iEvent->sparkPosition.angleOffset);
|
||||||
|
#endif
|
||||||
|
|
||||||
scheduleTask("spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnPinLow, iEvent->output);
|
scheduleTask("spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnPinLow, iEvent->output);
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
|
@ -318,9 +329,6 @@ 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) {
|
||||||
engine->m.beforeFuelCalc = GET_TIMESTAMP();
|
|
||||||
ENGINE(fuelMs) = getFuelMs(rpm PASS_ENGINE_PARAMETER) * engineConfiguration->globalFuelCorrection;
|
|
||||||
engine->m.fuelCalcTime = GET_TIMESTAMP() - engine->m.beforeFuelCalc;
|
|
||||||
|
|
||||||
engine->m.beforeIgnitionSch = GET_TIMESTAMP();
|
engine->m.beforeIgnitionSch = GET_TIMESTAMP();
|
||||||
/**
|
/**
|
||||||
|
@ -355,7 +363,7 @@ static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionI
|
||||||
initializeIgnitionActions(ENGINE(engineState.timingAdvance), ENGINE(engineState.dwellAngle), list PASS_ENGINE_PARAMETER);
|
initializeIgnitionActions(ENGINE(engineState.timingAdvance), ENGINE(engineState.dwellAngle), list PASS_ENGINE_PARAMETER);
|
||||||
engine->m.ignitionSchTime = GET_TIMESTAMP() - engine->m.beforeIgnitionSch;
|
engine->m.ignitionSchTime = GET_TIMESTAMP() - engine->m.beforeIgnitionSch;
|
||||||
|
|
||||||
engine->prepareFuelSchedule(PASS_ENGINE_PARAMETER_F);
|
// engine->prepareFuelSchedule(PASS_ENGINE_PARAMETER_F);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -167,7 +167,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
||||||
angle_t crankAngle = NAN;
|
angle_t crankAngle = NAN;
|
||||||
int signal = -1;
|
int signal = -1;
|
||||||
if (boardConfiguration->sensorChartMode == SC_TRIGGER) {
|
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
|
||||||
crankAngle = getCrankshaftAngleNt(nowNt PASS_ENGINE_PARAMETER);
|
crankAngle = getCrankshaftAngleNt(nowNt PASS_ENGINE_PARAMETER);
|
||||||
signal = 1000 * ckpSignalType + index;
|
signal = 1000 * ckpSignalType + index;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
||||||
|
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
||||||
if (boardConfiguration->sensorChartMode == SC_TRIGGER) {
|
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
|
||||||
scAddData(crankAngle, signal);
|
scAddData(crankAngle, signal);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -204,7 +204,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
||||||
rpmState->onNewEngineCycle();
|
rpmState->onNewEngineCycle();
|
||||||
rpmState->lastRpmEventTimeNt = nowNt;
|
rpmState->lastRpmEventTimeNt = nowNt;
|
||||||
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
|
||||||
if (boardConfiguration->sensorChartMode == SC_TRIGGER) {
|
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
|
||||||
scAddData(crankAngle, signal);
|
scAddData(crankAngle, signal);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -222,7 +222,7 @@ static char rpmBuffer[10];
|
||||||
*/
|
*/
|
||||||
static void onTdcCallback(void) {
|
static void onTdcCallback(void) {
|
||||||
itoa10(rpmBuffer, getRpmE(engine));
|
itoa10(rpmBuffer, getRpmE(engine));
|
||||||
addWaveChartEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
|
addEngineSniffferEvent(TOP_DEAD_CENTER_MESSAGE, (char* ) rpmBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -232,8 +232,7 @@ static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
||||||
uint32_t index0 DECLARE_ENGINE_PARAMETER_S) {
|
uint32_t index0 DECLARE_ENGINE_PARAMETER_S) {
|
||||||
(void) ckpSignalType;
|
(void) ckpSignalType;
|
||||||
bool isTriggerSynchronizationPoint = index0 == 0;
|
bool isTriggerSynchronizationPoint = index0 == 0;
|
||||||
if (isTriggerSynchronizationPoint
|
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) {
|
||||||
&& engineConfiguration->isEngineChartEnabled) {
|
|
||||||
int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
|
int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
|
||||||
int rpm = getRpmE(engine);
|
int rpm = getRpmE(engine);
|
||||||
// todo: use event-based scheduling, not just time-based scheduling
|
// todo: use event-based scheduling, not just time-based scheduling
|
||||||
|
|
|
@ -96,9 +96,9 @@ bool isCranking(void);
|
||||||
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
|
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
|
||||||
|
|
||||||
#if EFI_ENGINE_SNIFFER
|
#if EFI_ENGINE_SNIFFER
|
||||||
#define addWaveChartEvent(name, msg) waveChart.addWaveChartEvent3((name), (msg))
|
#define addEngineSniffferEvent(name, msg) waveChart.addEvent3((name), (msg))
|
||||||
#else
|
#else
|
||||||
#define addWaveChartEvent(n, msg) {}
|
#define addEngineSniffferEvent(n, msg) {}
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
||||||
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param, RpmCalculator *calc);
|
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param, RpmCalculator *calc);
|
||||||
|
|
|
@ -118,11 +118,11 @@ static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType,
|
||||||
bool 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);
|
addEngineSniffferEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||||
if (engineConfiguration->useOnlyFrontForTrigger) {
|
if (engineConfiguration->useOnlyFrontForTrigger) {
|
||||||
// let's add the opposite event right away
|
// let's add the opposite event right away
|
||||||
shaft_signal_msg_index[0] = isUp ? 'd' : 'u';
|
shaft_signal_msg_index[0] = isUp ? 'd' : 'u';
|
||||||
addWaveChartEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
addEngineSniffferEvent(eventId[(int )ckpSignalType], (char* ) shaft_signal_msg_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,11 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
float prevGap = 1.0 * toothed_previous_duration / durationBeforePrevious;
|
float prevGap = 1.0 * toothed_previous_duration / durationBeforePrevious;
|
||||||
float gap3 = 1.0 * durationBeforePrevious / thirdPreviousDuration;
|
float gap3 = 1.0 * durationBeforePrevious / thirdPreviousDuration;
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
scheduleMsg(logger, "gap=%f/%f/%f @ %d while expected %f/%f/%f and %f/%f error=%d", gap, prevGap, gap3, currentCycle.current_index, TRIGGER_SHAPE(syncRatioFrom), TRIGGER_SHAPE(syncRatioTo), TRIGGER_SHAPE(secondSyncRatioFrom), TRIGGER_SHAPE(secondSyncRatioTo), someSortOfTriggerError);
|
scheduleMsg(logger, "gap=%f/%f/%f @ %d while expected %f/%f and %f/%f error=%d",
|
||||||
|
gap, prevGap, gap3,
|
||||||
|
currentCycle.current_index,
|
||||||
|
TRIGGER_SHAPE(syncRatioFrom), TRIGGER_SHAPE(syncRatioTo),
|
||||||
|
TRIGGER_SHAPE(secondSyncRatioFrom), TRIGGER_SHAPE(secondSyncRatioTo), someSortOfTriggerError);
|
||||||
#else
|
#else
|
||||||
actualSynchGap = gap;
|
actualSynchGap = gap;
|
||||||
print("current gap %f/%f/%f c=%d prev=%d\r\n", gap, prevGap, gap3, currentDuration, toothed_previous_duration);
|
print("current gap %f/%f/%f c=%d prev=%d\r\n", gap, prevGap, gap3, currentDuration, toothed_previous_duration);
|
||||||
|
@ -303,7 +307,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boardConfiguration->sensorChartMode == SC_RPM_ACCEL || boardConfiguration->sensorChartMode == SC_DETAILED_RPM) {
|
if (ENGINE(sensorChartMode) == SC_RPM_ACCEL || ENGINE(sensorChartMode) == SC_DETAILED_RPM) {
|
||||||
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
|
angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]);
|
||||||
// todo: make this '90' depend on cylinder count?
|
// todo: make this '90' depend on cylinder count?
|
||||||
angle_t prevAngle = currentAngle - 90;
|
angle_t prevAngle = currentAngle - 90;
|
||||||
|
|
|
@ -116,7 +116,7 @@ void setTriggerEmulatorRPM(int rpm, Engine *engine) {
|
||||||
}
|
}
|
||||||
#if EFI_ENGINE_SNIFFER
|
#if EFI_ENGINE_SNIFFER
|
||||||
if (engine->isTestMode)
|
if (engine->isTestMode)
|
||||||
waveChart.resetWaveChart();
|
waveChart.reset();
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
|
|
||||||
scheduleMsg(logger, "Emulating position sensor(s). RPM=%d", rpm);
|
scheduleMsg(logger, "Emulating position sensor(s). RPM=%d", rpm);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
||||||
#include "rfiutil.h"
|
#include "rfiutil.h"
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
static histogram_s waveChartHisto;
|
static histogram_s engineSnifferHisto;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN_ENGINE
|
EXTERN_ENGINE
|
||||||
|
@ -73,13 +73,13 @@ static uint32_t skipUntilEngineCycle = 0;
|
||||||
|
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
extern WaveChart waveChart;
|
extern WaveChart waveChart;
|
||||||
static void resetWaveChartNow(void) {
|
static void resetNow(void) {
|
||||||
skipUntilEngineCycle = engine->rpmCalculator.getRevolutionCounter() + 3;
|
skipUntilEngineCycle = engine->rpmCalculator.getRevolutionCounter() + 3;
|
||||||
waveChart.resetWaveChart();
|
waveChart.reset();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void WaveChart::resetWaveChart() {
|
void WaveChart::reset() {
|
||||||
#if DEBUG_WAVE
|
#if DEBUG_WAVE
|
||||||
scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
|
scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
|
||||||
#endif /* DEBUG_WAVE */
|
#endif /* DEBUG_WAVE */
|
||||||
|
@ -102,7 +102,7 @@ bool WaveChart::isStartedTooLongAgo() {
|
||||||
return startTimeNt != 0 && NT2US(chartDurationNt) > engineConfiguration->engineChartSize * 1000000 / 20;
|
return startTimeNt != 0 && NT2US(chartDurationNt) > engineConfiguration->engineChartSize * 1000000 / 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WaveChart::isWaveChartFull() {
|
bool WaveChart::isFull() {
|
||||||
return counter >= engineConfiguration->engineChartSize;
|
return counter >= engineConfiguration->engineChartSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +125,10 @@ void setChartSize(int newSize) {
|
||||||
printStatus();
|
printStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveChart::publishChartIfFull() {
|
void WaveChart::publishIfFull() {
|
||||||
if (isWaveChartFull() || isStartedTooLongAgo()) {
|
if (isFull() || isStartedTooLongAgo()) {
|
||||||
publishChart();
|
publish();
|
||||||
resetWaveChart();
|
reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +141,10 @@ WaveChart::WaveChart() {
|
||||||
void WaveChart::init() {
|
void WaveChart::init() {
|
||||||
initLoggingExt(&logging, "wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
|
initLoggingExt(&logging, "wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
resetWaveChart();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveChart::publishChart() {
|
void WaveChart::publish() {
|
||||||
appendPrintf(&logging, DELIMETER);
|
appendPrintf(&logging, DELIMETER);
|
||||||
waveChartUsedSize = loggingSize(&logging);
|
waveChartUsedSize = loggingSize(&logging);
|
||||||
#if DEBUG_WAVE
|
#if DEBUG_WAVE
|
||||||
|
@ -152,7 +152,7 @@ void WaveChart::publishChart() {
|
||||||
scheduleSimpleMsg(&debugLogging, "IT'S TIME", strlen(l->buffer));
|
scheduleSimpleMsg(&debugLogging, "IT'S TIME", strlen(l->buffer));
|
||||||
#endif
|
#endif
|
||||||
bool isFullLog = getFullLog();
|
bool isFullLog = getFullLog();
|
||||||
if (engineConfiguration->isEngineChartEnabled && isFullLog) {
|
if (ENGINE(isEngineChartEnabled) && isFullLog) {
|
||||||
scheduleLogging(&logging);
|
scheduleLogging(&logging);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,11 +162,11 @@ static char timeBuffer[10];
|
||||||
/**
|
/**
|
||||||
* @brief Register an event for digital sniffer
|
* @brief Register an event for digital sniffer
|
||||||
*/
|
*/
|
||||||
void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
|
void WaveChart::addEvent3(const char *name, const char * msg) {
|
||||||
if (skipUntilEngineCycle != 0 && engine->rpmCalculator.getRevolutionCounter() < skipUntilEngineCycle)
|
if (skipUntilEngineCycle != 0 && engine->rpmCalculator.getRevolutionCounter() < skipUntilEngineCycle)
|
||||||
return;
|
return;
|
||||||
efiAssertVoid(name!=NULL, "WC: NULL name");
|
efiAssertVoid(name!=NULL, "WC: NULL name");
|
||||||
if (!engineConfiguration->isEngineChartEnabled) {
|
if (!ENGINE(isEngineChartEnabled)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
|
||||||
#if DEBUG_WAVE
|
#if DEBUG_WAVE
|
||||||
scheduleSimpleMsg(&debugLogging, "current", chart->counter);
|
scheduleSimpleMsg(&debugLogging, "current", chart->counter);
|
||||||
#endif
|
#endif
|
||||||
if (isWaveChartFull()) {
|
if (isFull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
|
||||||
#if EFI_HISTOGRAMS && EFI_PROD_CODE
|
#if EFI_HISTOGRAMS && EFI_PROD_CODE
|
||||||
int64_t diff = hal_lld_get_counter_value() - beforeCallback;
|
int64_t diff = hal_lld_get_counter_value() - beforeCallback;
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
hsAdd(&waveChartHisto, diff);
|
hsAdd(&engineSnifferHisto, diff);
|
||||||
}
|
}
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
|
||||||
|
@ -237,16 +237,11 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
|
||||||
|
|
||||||
void showWaveChartHistogram(void) {
|
void showWaveChartHistogram(void) {
|
||||||
#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__)
|
#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__)
|
||||||
printHistogram(&logger, &waveChartHisto);
|
printHistogram(&logger, &engineSnifferHisto);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void initWaveChart(WaveChart *chart) {
|
void initWaveChart(WaveChart *chart) {
|
||||||
|
|
||||||
if (!engineConfiguration->isEngineChartEnabled) {
|
|
||||||
printMsg(&logger, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! chart disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor does not work because we need specific initialization order
|
* constructor does not work because we need specific initialization order
|
||||||
*/
|
*/
|
||||||
|
@ -259,13 +254,13 @@ void initWaveChart(WaveChart *chart) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
|
||||||
initHistogram(&waveChartHisto, "wave chart");
|
initHistogram(&engineSnifferHisto, "wave chart");
|
||||||
#endif /* EFI_HISTOGRAMS */
|
#endif /* EFI_HISTOGRAMS */
|
||||||
|
|
||||||
addConsoleActionI("chartsize", setChartSize);
|
addConsoleActionI("chartsize", setChartSize);
|
||||||
addConsoleActionI("chart", setChartActive);
|
addConsoleActionI("chart", setChartActive);
|
||||||
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
|
||||||
addConsoleAction("reset_engine_chart", resetWaveChartNow);
|
addConsoleAction("reset_engine_chart", resetNow);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ class WaveChart {
|
||||||
public:
|
public:
|
||||||
WaveChart();
|
WaveChart();
|
||||||
void init();
|
void init();
|
||||||
void publishChart();
|
void addEvent3(const char *name, const char *msg);
|
||||||
void resetWaveChart();
|
void reset();
|
||||||
bool isWaveChartFull();
|
void publishIfFull();
|
||||||
|
void publish();
|
||||||
|
bool isFull();
|
||||||
bool isStartedTooLongAgo();
|
bool isStartedTooLongAgo();
|
||||||
void publishChartIfFull();
|
|
||||||
void addWaveChartEvent3(const char *name, const char *msg);
|
|
||||||
private:
|
private:
|
||||||
Logging logging;
|
Logging logging;
|
||||||
uint32_t counter;
|
uint32_t counter;
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void waAnaWidthCallback(WaveReader *reader) {
|
||||||
efitick_t nowUs = getTimeNowUs();
|
efitick_t nowUs = getTimeNowUs();
|
||||||
reader->eventCounter++;
|
reader->eventCounter++;
|
||||||
reader->lastActivityTimeUs = nowUs;
|
reader->lastActivityTimeUs = nowUs;
|
||||||
addWaveChartEvent(reader->name, WC_UP);
|
addEngineSniffferEvent(reader->name, WC_UP);
|
||||||
|
|
||||||
uint32_t width = nowUs - reader->periodEventTimeUs;
|
uint32_t width = nowUs - reader->periodEventTimeUs;
|
||||||
reader->last_wave_low_widthUs = width;
|
reader->last_wave_low_widthUs = width;
|
||||||
|
@ -72,7 +72,7 @@ void WaveReader::onFallEvent() {
|
||||||
efitick_t nowUs = getTimeNowUs();
|
efitick_t nowUs = getTimeNowUs();
|
||||||
eventCounter++;
|
eventCounter++;
|
||||||
lastActivityTimeUs = nowUs;
|
lastActivityTimeUs = nowUs;
|
||||||
addWaveChartEvent(name, WC_DOWN);
|
addEngineSniffferEvent(name, WC_DOWN);
|
||||||
|
|
||||||
efitick_t width = nowUs - widthEventTimeUs;
|
efitick_t width = nowUs - widthEventTimeUs;
|
||||||
last_wave_high_widthUs = width;
|
last_wave_high_widthUs = width;
|
||||||
|
@ -158,7 +158,7 @@ static THD_FUNCTION(waThread, arg) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
chThdSleepSeconds(CHART_RESET_DELAY);
|
chThdSleepSeconds(CHART_RESET_DELAY);
|
||||||
|
|
||||||
waveChart.publishChartIfFull();
|
waveChart.publishIfFull();
|
||||||
}
|
}
|
||||||
#endif /* EFI_ENGINE_SNIFFER */
|
#endif /* EFI_ENGINE_SNIFFER */
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* @brief Low level ADC code
|
* @brief Low level ADC code
|
||||||
*
|
*
|
||||||
* We are using two ADC devices here.
|
* We are using two ADC devices here.
|
||||||
* Slow ADC group is used for IAT, CLT, AFR, VBATT etc - this one is currently sampled at 10Hz
|
* Slow ADC group is used for IAT, CLT, AFR, VBATT etc - this one is currently sampled at 20Hz
|
||||||
*
|
*
|
||||||
* Fast ADC group is used for TPS, MAP, MAF HIP
|
* Fast ADC group is used for TPS, MAP, MAF HIP
|
||||||
*
|
*
|
||||||
|
@ -43,9 +43,9 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) {
|
||||||
|
|
||||||
// todo: migrate from hardware timer to software ADC conversion triggering
|
// todo: migrate from hardware timer to software ADC conversion triggering
|
||||||
// todo: I guess we would have to use ChibiOS timer and not our own timer because
|
// todo: I guess we would have to use ChibiOS timer and not our own timer because
|
||||||
// todo: adcStartConversionI requires OS lock. currently slow ADC is 10Hz
|
// todo: adcStartConversionI requires OS lock. currently slow ADC is 20Hz
|
||||||
#define PWM_FREQ_SLOW 5000 /* PWM clock frequency. I wonder what does this setting mean? */
|
#define PWM_FREQ_SLOW 5000 /* PWM clock frequency. I wonder what does this setting mean? */
|
||||||
#define PWM_PERIOD_SLOW 500 /* PWM period (in PWM ticks). */
|
#define PWM_PERIOD_SLOW 250 /* PWM period (in PWM ticks). */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 8000 RPM is 133Hz
|
* 8000 RPM is 133Hz
|
||||||
|
@ -62,6 +62,7 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) {
|
||||||
// is there a reason to have this configurable?
|
// is there a reason to have this configurable?
|
||||||
#define ADC_FAST_DEVICE ADCD2
|
#define ADC_FAST_DEVICE ADCD2
|
||||||
|
|
||||||
|
static int slowAdcCounter = 0;
|
||||||
static char LOGGING_BUFFER[500];
|
static char LOGGING_BUFFER[500];
|
||||||
static Logging logger("ADC", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
|
static Logging logger("ADC", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
|
||||||
|
|
||||||
|
@ -459,8 +460,11 @@ static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
|
||||||
/* Calculates the average values from the ADC samples.*/
|
/* Calculates the average values from the ADC samples.*/
|
||||||
for (int i = 0; i < slowAdc.size(); i++) {
|
for (int i = 0; i < slowAdc.size(); i++) {
|
||||||
int value = getAvgAdcValue(i, slowAdc.samples, ADC_BUF_DEPTH_SLOW, slowAdc.size());
|
int value = getAvgAdcValue(i, slowAdc.samples, ADC_BUF_DEPTH_SLOW, slowAdc.size());
|
||||||
slowAdc.values.adc_data[i] = value;
|
adcsample_t prev = slowAdc.values.adc_data[i];
|
||||||
|
slowAdc.values.adc_data[i] = (slowAdcCounter == 0) ? value :
|
||||||
|
CONFIG(slowAdcAlpha) * value + (1 - CONFIG(slowAdcAlpha)) * prev;
|
||||||
}
|
}
|
||||||
|
slowAdcCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ static const char * msg;
|
||||||
|
|
||||||
static char buff[32];
|
static char buff[32];
|
||||||
|
|
||||||
|
static int timerFreezeCounter = 0;
|
||||||
|
|
||||||
extern bool hasFirmwareErrorFlag;
|
extern bool hasFirmwareErrorFlag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,7 +46,15 @@ extern bool hasFirmwareErrorFlag;
|
||||||
* This function should be invoked under kernel lock which would disable interrupts.
|
* This function should be invoked under kernel lock which would disable interrupts.
|
||||||
*/
|
*/
|
||||||
void setHardwareUsTimer(int32_t timeUs) {
|
void setHardwareUsTimer(int32_t timeUs) {
|
||||||
if (timeUs == 1)
|
/**
|
||||||
|
* #259 BUG error: not positive timeUs
|
||||||
|
* Once in a while we night get an interrupt where we do not expect it
|
||||||
|
*/
|
||||||
|
if (timeUs <= 0) {
|
||||||
|
timerFreezeCounter++;
|
||||||
|
warning(OBD_PCM_Processor_Fault, "local freeze cnt=%d", timerFreezeCounter);
|
||||||
|
}
|
||||||
|
if (timeUs < 2)
|
||||||
timeUs = 2; // for some reason '1' does not really work
|
timeUs = 2; // for some reason '1' does not really work
|
||||||
efiAssertVoid(timeUs > 0, "not positive timeUs");
|
efiAssertVoid(timeUs > 0, "not positive timeUs");
|
||||||
efiAssertVoid(timeUs < 10 * US_PER_SECOND, "setHardwareUsTimer() too large");
|
efiAssertVoid(timeUs < 10 * US_PER_SECOND, "setHardwareUsTimer() too large");
|
||||||
|
|
|
@ -133,7 +133,7 @@ end_struct
|
||||||
custom engine_type_e 4 bits, S32, @OFFSET@, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
|
custom engine_type_e 4 bits, S32, @OFFSET@, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
|
||||||
engine_type_e engineType;http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
|
engine_type_e engineType;http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
|
||||||
|
|
||||||
int unusedOffset4;
|
int engineSnifferRpmThreshold;Disable engine sniffer above this rpm;"RPM", 1, 0, 0,30000, 0
|
||||||
|
|
||||||
struct injector_s
|
struct injector_s
|
||||||
float flow;cc/min, cubic centimeter per minute\nBy the way, g/s = 0.125997881 * (lb/hr)\ng/s = 0.125997881 * (cc/min)/10.5\ng/s = 0.0119997981 * cc/min;"cm3/min", 1, 0, 0, 1000, 2
|
float flow;cc/min, cubic centimeter per minute\nBy the way, g/s = 0.125997881 * (lb/hr)\ng/s = 0.125997881 * (cc/min)/10.5\ng/s = 0.0119997981 * cc/min;"cm3/min", 1, 0, 0, 1000, 2
|
||||||
|
@ -188,7 +188,7 @@ end_struct
|
||||||
|
|
||||||
specs_s specs
|
specs_s specs
|
||||||
float cylinderBore;Cylinder diameter, in mm.
|
float cylinderBore;Cylinder diameter, in mm.
|
||||||
int unused34234;
|
int sensorSnifferRpmThreshold;Disable sensor sniffer above this rpm;"RPM", 1, 0, 0,30000, 0
|
||||||
int rpmHardLimit;;"rpm", 1, 0, 0, 20000.0, 2
|
int rpmHardLimit;;"rpm", 1, 0, 0, 20000.0, 2
|
||||||
|
|
||||||
|
|
||||||
|
@ -630,7 +630,8 @@ baro_corr_table_t baroCorrTable;
|
||||||
uint32_t uartConsoleSerialSpeed;;"BPs", 1, 0, 0,1000000, 0
|
uint32_t uartConsoleSerialSpeed;;"BPs", 1, 0, 0,1000000, 0
|
||||||
float tpsDecelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3
|
float tpsDecelEnleanmentThreshold;;"roc", 1, 0, 0, 200, 3
|
||||||
float tpsDecelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3
|
float tpsDecelEnleanmentMultiplier;;"coeff", 1, 0, 0, 200, 3
|
||||||
int[194] unused;
|
float slowAdcAlpha;;"coeff", 1, 0, 0, 200, 3
|
||||||
|
int[193] unused;
|
||||||
|
|
||||||
|
|
||||||
end_struct
|
end_struct
|
||||||
|
|
|
@ -275,5 +275,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20160125;
|
return 20160128;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by Version2Header
|
// This file was generated by Version2Header
|
||||||
// Fri Jan 22 16:36:27 EST 2016
|
// Thu Jan 28 20:12:19 EST 2016
|
||||||
#ifndef VCS_VERSION
|
#ifndef VCS_VERSION
|
||||||
#define VCS_VERSION "9358"
|
#define VCS_VERSION "9438"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.rusefi.config;
|
package com.rusefi.config;
|
||||||
|
|
||||||
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 22 12:32:32 EST 2016
|
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016
|
||||||
public class Fields {
|
public class Fields {
|
||||||
public static final int LE_COMMAND_LENGTH = 200;
|
public static final int LE_COMMAND_LENGTH = 200;
|
||||||
public static final int TS_FILE_VERSION = 20160122;
|
public static final int TS_FILE_VERSION = 20160122;
|
||||||
|
@ -31,8 +31,8 @@ public class Fields {
|
||||||
public static final int engineConfiguration_offset_hex = 0;
|
public static final int engineConfiguration_offset_hex = 0;
|
||||||
public static final int engineType_offset = 0;
|
public static final int engineType_offset = 0;
|
||||||
public static final int engineType_offset_hex = 0;
|
public static final int engineType_offset_hex = 0;
|
||||||
public static final int unusedOffset4_offset = 4;
|
public static final int engineSnifferRpmThreshold_offset = 4;
|
||||||
public static final int unusedOffset4_offset_hex = 4;
|
public static final int engineSnifferRpmThreshold_offset_hex = 4;
|
||||||
public static final int injector_offset = 8;
|
public static final int injector_offset = 8;
|
||||||
public static final int injector_offset_hex = 8;
|
public static final int injector_offset_hex = 8;
|
||||||
public static final int injector_flow_offset = 8;
|
public static final int injector_flow_offset = 8;
|
||||||
|
@ -131,7 +131,7 @@ public class Fields {
|
||||||
public static final int firingOrder_offset = 408;
|
public static final int firingOrder_offset = 408;
|
||||||
public static final int firingOrder_offset_hex = 198;
|
public static final int firingOrder_offset_hex = 198;
|
||||||
public static final int cylinderBore_offset = 412;
|
public static final int cylinderBore_offset = 412;
|
||||||
public static final int unused34234_offset = 416;
|
public static final int sensorSnifferRpmThreshold_offset = 416;
|
||||||
public static final int rpmHardLimit_offset = 420;
|
public static final int rpmHardLimit_offset = 420;
|
||||||
public static final int algorithm_offset = 424;
|
public static final int algorithm_offset = 424;
|
||||||
public static final int crankingInjectionMode_offset = 428;
|
public static final int crankingInjectionMode_offset = 428;
|
||||||
|
@ -734,7 +734,8 @@ public class Fields {
|
||||||
public static final int uartConsoleSerialSpeed_offset = 2228;
|
public static final int uartConsoleSerialSpeed_offset = 2228;
|
||||||
public static final int tpsDecelEnleanmentThreshold_offset = 2232;
|
public static final int tpsDecelEnleanmentThreshold_offset = 2232;
|
||||||
public static final int tpsDecelEnleanmentMultiplier_offset = 2236;
|
public static final int tpsDecelEnleanmentMultiplier_offset = 2236;
|
||||||
public static final int unused_offset = 2240;
|
public static final int slowAdcAlpha_offset = 2240;
|
||||||
|
public static final int unused_offset = 2244;
|
||||||
public static final int le_formulas1_offset = 3016;
|
public static final int le_formulas1_offset = 3016;
|
||||||
public static final int le_formulas2_offset = 3216;
|
public static final int le_formulas2_offset = 3216;
|
||||||
public static final int le_formulas3_offset = 3416;
|
public static final int le_formulas3_offset = 3416;
|
||||||
|
@ -800,7 +801,7 @@ public class Fields {
|
||||||
public static final int afrRpmBins_offset = 16024;
|
public static final int afrRpmBins_offset = 16024;
|
||||||
public static final int TOTAL_CONFIG_SIZE = 16088;
|
public static final int TOTAL_CONFIG_SIZE = 16088;
|
||||||
public static final Field ENGINETYPE = Field.create("ENGINETYPE", 0, FieldType.INT);
|
public static final Field ENGINETYPE = Field.create("ENGINETYPE", 0, FieldType.INT);
|
||||||
public static final Field UNUSEDOFFSET4 = Field.create("UNUSEDOFFSET4", 4, FieldType.INT);
|
public static final Field ENGINESNIFFERRPMTHRESHOLD = Field.create("ENGINESNIFFERRPMTHRESHOLD", 4, FieldType.INT);
|
||||||
public static final Field INJECTOR_FLOW = Field.create("INJECTOR_FLOW", 8, FieldType.FLOAT);
|
public static final Field INJECTOR_FLOW = Field.create("INJECTOR_FLOW", 8, FieldType.FLOAT);
|
||||||
public static final Field INJECTOR_LAG = Field.create("INJECTOR_LAG", 12, FieldType.FLOAT);
|
public static final Field INJECTOR_LAG = Field.create("INJECTOR_LAG", 12, FieldType.FLOAT);
|
||||||
public static final Field DIRECTSELFSTIMULATION = Field.create("DIRECTSELFSTIMULATION", 80, FieldType.BIT, 0);
|
public static final Field DIRECTSELFSTIMULATION = Field.create("DIRECTSELFSTIMULATION", 80, FieldType.BIT, 0);
|
||||||
|
@ -842,7 +843,7 @@ public class Fields {
|
||||||
public static final Field CYLINDERSCOUNT = Field.create("CYLINDERSCOUNT", 404, FieldType.INT);
|
public static final Field CYLINDERSCOUNT = Field.create("CYLINDERSCOUNT", 404, FieldType.INT);
|
||||||
public static final Field FIRINGORDER = Field.create("FIRINGORDER", 408, FieldType.INT);
|
public static final Field FIRINGORDER = Field.create("FIRINGORDER", 408, FieldType.INT);
|
||||||
public static final Field CYLINDERBORE = Field.create("CYLINDERBORE", 412, FieldType.FLOAT);
|
public static final Field CYLINDERBORE = Field.create("CYLINDERBORE", 412, FieldType.FLOAT);
|
||||||
public static final Field UNUSED34234 = Field.create("UNUSED34234", 416, FieldType.INT);
|
public static final Field SENSORSNIFFERRPMTHRESHOLD = Field.create("SENSORSNIFFERRPMTHRESHOLD", 416, FieldType.INT);
|
||||||
public static final Field RPMHARDLIMIT = Field.create("RPMHARDLIMIT", 420, FieldType.INT);
|
public static final Field RPMHARDLIMIT = Field.create("RPMHARDLIMIT", 420, FieldType.INT);
|
||||||
public static final String[] engine_load_mode_e = {"MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY"};
|
public static final String[] engine_load_mode_e = {"MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY"};
|
||||||
public static final Field ALGORITHM = Field.create("ALGORITHM", 424, FieldType.INT, engine_load_mode_e);
|
public static final Field ALGORITHM = Field.create("ALGORITHM", 424, FieldType.INT, engine_load_mode_e);
|
||||||
|
@ -1258,6 +1259,7 @@ public class Fields {
|
||||||
public static final Field UARTCONSOLESERIALSPEED = Field.create("UARTCONSOLESERIALSPEED", 2228, FieldType.INT);
|
public static final Field UARTCONSOLESERIALSPEED = Field.create("UARTCONSOLESERIALSPEED", 2228, FieldType.INT);
|
||||||
public static final Field TPSDECELENLEANMENTTHRESHOLD = Field.create("TPSDECELENLEANMENTTHRESHOLD", 2232, FieldType.FLOAT);
|
public static final Field TPSDECELENLEANMENTTHRESHOLD = Field.create("TPSDECELENLEANMENTTHRESHOLD", 2232, FieldType.FLOAT);
|
||||||
public static final Field TPSDECELENLEANMENTMULTIPLIER = Field.create("TPSDECELENLEANMENTMULTIPLIER", 2236, FieldType.FLOAT);
|
public static final Field TPSDECELENLEANMENTMULTIPLIER = Field.create("TPSDECELENLEANMENTMULTIPLIER", 2236, FieldType.FLOAT);
|
||||||
|
public static final Field SLOWADCALPHA = Field.create("SLOWADCALPHA", 2240, FieldType.FLOAT);
|
||||||
public static final Field LE_FORMULAS1 = Field.create("LE_FORMULAS1", 3016, FieldType.INT);
|
public static final Field LE_FORMULAS1 = Field.create("LE_FORMULAS1", 3016, FieldType.INT);
|
||||||
public static final Field LE_FORMULAS2 = Field.create("LE_FORMULAS2", 3216, FieldType.INT);
|
public static final Field LE_FORMULAS2 = Field.create("LE_FORMULAS2", 3216, FieldType.INT);
|
||||||
public static final Field LE_FORMULAS3 = Field.create("LE_FORMULAS3", 3416, FieldType.INT);
|
public static final Field LE_FORMULAS3 = Field.create("LE_FORMULAS3", 3416, FieldType.INT);
|
||||||
|
|
|
@ -90,13 +90,13 @@ public enum Sensor {
|
||||||
DWELL(SensorCategory.OPERATIONS, FieldType.FLOAT, 60, BackgroundColor.MUD, 1, 10),
|
DWELL(SensorCategory.OPERATIONS, FieldType.FLOAT, 60, BackgroundColor.MUD, 1, 10),
|
||||||
CURRENT_VE(SensorCategory.FUEL, FieldType.FLOAT, 112, BackgroundColor.MUD),
|
CURRENT_VE(SensorCategory.FUEL, FieldType.FLOAT, 112, BackgroundColor.MUD),
|
||||||
|
|
||||||
TPS_DELTA(SensorCategory.FUEL, FieldType.FLOAT, 116, BackgroundColor.MUD),
|
deltaTps(SensorCategory.FUEL, FieldType.FLOAT, 116, BackgroundColor.MUD),
|
||||||
ENGINE_LOAD_ACCEL_DELTA(SensorCategory.FUEL, FieldType.FLOAT, 124, BackgroundColor.MUD),
|
engineLoadAccelDelta(SensorCategory.FUEL, FieldType.FLOAT, 124, BackgroundColor.MUD),
|
||||||
TPS_ACCEL_FUEL(SensorCategory.FUEL, FieldType.FLOAT, 128, BackgroundColor.MUD),
|
tpsAccelFuel(SensorCategory.FUEL, FieldType.FLOAT, 128, BackgroundColor.MUD),
|
||||||
Injector_duty(SensorCategory.OPERATIONS, FieldType.FLOAT, 140, BackgroundColor.MUD),
|
Injector_duty(SensorCategory.OPERATIONS, FieldType.FLOAT, 140, BackgroundColor.MUD),
|
||||||
WALL_FUEL_AMOUNT(SensorCategory.FUEL, FieldType.FLOAT, 160, BackgroundColor.MUD),
|
wallFuelAmount(SensorCategory.FUEL, FieldType.FLOAT, 160, BackgroundColor.MUD),
|
||||||
iatCorrection(SensorCategory.FUEL, FieldType.FLOAT, 164, BackgroundColor.MUD, 0, 5),
|
iatCorrection(SensorCategory.FUEL, FieldType.FLOAT, 164, BackgroundColor.MUD, 0, 5),
|
||||||
WALL_FUEL_CORRECTION(SensorCategory.FUEL, FieldType.FLOAT, 168, BackgroundColor.MUD),
|
wallFuelCorrection(SensorCategory.FUEL, FieldType.FLOAT, 168, BackgroundColor.MUD),
|
||||||
idlePosition(SensorCategory.OPERATIONS, FieldType.FLOAT, 172, BackgroundColor.MUD),
|
idlePosition(SensorCategory.OPERATIONS, FieldType.FLOAT, 172, BackgroundColor.MUD),
|
||||||
TARGET_AFR(SensorCategory.OPERATIONS, FieldType.FLOAT, 176, BackgroundColor.MUD),
|
TARGET_AFR(SensorCategory.OPERATIONS, FieldType.FLOAT, 176, BackgroundColor.MUD),
|
||||||
CHARGE_AIR_MASS(SensorCategory.OPERATIONS, FieldType.FLOAT, 180, BackgroundColor.MUD),
|
CHARGE_AIR_MASS(SensorCategory.OPERATIONS, FieldType.FLOAT, 180, BackgroundColor.MUD),
|
||||||
|
@ -104,6 +104,11 @@ public enum Sensor {
|
||||||
runningFuel(SensorCategory.OPERATIONS, FieldType.FLOAT, 188, BackgroundColor.MUD, 0, 15, "ms"),
|
runningFuel(SensorCategory.OPERATIONS, FieldType.FLOAT, 188, BackgroundColor.MUD, 0, 15, "ms"),
|
||||||
injectorLagMs(SensorCategory.FUEL, FieldType.FLOAT, 196, BackgroundColor.MUD, 0, 15, "ms"),
|
injectorLagMs(SensorCategory.FUEL, FieldType.FLOAT, 196, BackgroundColor.MUD, 0, 15, "ms"),
|
||||||
|
|
||||||
|
debugFloatField2(SensorCategory.OPERATIONS, FieldType.FLOAT, 200, BackgroundColor.MUD, 0, 5),
|
||||||
|
debugFloatField3(SensorCategory.OPERATIONS, FieldType.FLOAT, 204, BackgroundColor.MUD, 0, 5),
|
||||||
|
debugFloatField4(SensorCategory.OPERATIONS, FieldType.FLOAT, 208, BackgroundColor.MUD, 0, 5),
|
||||||
|
debugFloatField5(SensorCategory.OPERATIONS, FieldType.FLOAT, 212, BackgroundColor.MUD, 0, 5),
|
||||||
|
|
||||||
INJ_1_2_DELTA("inj 1-2 delta", SensorCategory.SNIFFING),
|
INJ_1_2_DELTA("inj 1-2 delta", SensorCategory.SNIFFING),
|
||||||
INJ_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),
|
INJ_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),
|
||||||
;
|
;
|
||||||
|
|
|
@ -110,8 +110,8 @@ public class FormulasPane {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private String getAccelerationVariables(ConfigurationImage ci) {
|
private String getAccelerationVariables(ConfigurationImage ci) {
|
||||||
String tpsDelta = oneDecimal(Sensor.TPS_DELTA);
|
String tpsDelta = oneDecimal(Sensor.deltaTps);
|
||||||
String elDelta = oneDecimal(Sensor.ENGINE_LOAD_ACCEL_DELTA);
|
String elDelta = oneDecimal(Sensor.engineLoadAccelDelta);
|
||||||
|
|
||||||
int tpsEnrichLength = ConfigField.getIntValue(ci, Fields.TPSACCELLENGTH);
|
int tpsEnrichLength = ConfigField.getIntValue(ci, Fields.TPSACCELLENGTH);
|
||||||
int elEnrichLength = ConfigField.getIntValue(ci, Fields.ENGINELOADACCELLENGTH);
|
int elEnrichLength = ConfigField.getIntValue(ci, Fields.ENGINELOADACCELLENGTH);
|
||||||
|
@ -121,7 +121,7 @@ public class FormulasPane {
|
||||||
|
|
||||||
double tpsAccelThreshold = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTTHRESHOLD);
|
double tpsAccelThreshold = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTTHRESHOLD);
|
||||||
double tpsAccelMult = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTMULTIPLIER);
|
double tpsAccelMult = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTMULTIPLIER);
|
||||||
String tpsAccelValue = oneDecimal(Sensor.TPS_ACCEL_FUEL);
|
String tpsAccelValue = oneDecimal(Sensor.tpsAccelFuel);
|
||||||
|
|
||||||
double tpsDecelThreshold = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTTHRESHOLD);
|
double tpsDecelThreshold = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTTHRESHOLD);
|
||||||
double tpsDecelMult = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTMULTIPLIER);
|
double tpsDecelMult = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTMULTIPLIER);
|
||||||
|
@ -179,7 +179,7 @@ public class FormulasPane {
|
||||||
|
|
||||||
String IATcorr = oneDecimal(Sensor.iatCorrection);
|
String IATcorr = oneDecimal(Sensor.iatCorrection);
|
||||||
String CLTcorr = oneDecimal(Sensor.cltCorrection);
|
String CLTcorr = oneDecimal(Sensor.cltCorrection);
|
||||||
String tpsAccel = oneDecimal(Sensor.TPS_ACCEL_FUEL);
|
String tpsAccel = oneDecimal(Sensor.tpsAccelFuel);
|
||||||
|
|
||||||
String runningFuel = oneDecimal(Sensor.runningFuel);
|
String runningFuel = oneDecimal(Sensor.runningFuel);
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class FuelTunePane {
|
||||||
double engineLoad = sc.getValue(Sensor.MAP);
|
double engineLoad = sc.getValue(Sensor.MAP);
|
||||||
double afr = sc.getValue(Sensor.AFR);
|
double afr = sc.getValue(Sensor.AFR);
|
||||||
// todo: add UI for pre-conditions
|
// todo: add UI for pre-conditions
|
||||||
double deltaTps = sc.getValue(Sensor.TPS_DELTA);
|
double deltaTps = sc.getValue(Sensor.deltaTps);
|
||||||
double clt = sc.getValue(Sensor.CLT);
|
double clt = sc.getValue(Sensor.CLT);
|
||||||
// if (clt < 80)
|
// if (clt < 80)
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -318,6 +318,9 @@ void testRpmCalculator(void) {
|
||||||
timeNow = 0;
|
timeNow = 0;
|
||||||
assertEquals(0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
assertEquals(0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||||
|
|
||||||
|
assertEquals(4, engine->triggerShape.triggerIndexByAngle[240]);
|
||||||
|
assertEquals(4, engine->triggerShape.triggerIndexByAngle[241]);
|
||||||
|
|
||||||
eth.fireTriggerEvents(48);
|
eth.fireTriggerEvents(48);
|
||||||
|
|
||||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
|
||||||
|
@ -341,10 +344,14 @@ void testRpmCalculator(void) {
|
||||||
int st = timeNow;
|
int st = timeNow;
|
||||||
assertEqualsM("st value", 485000, st);
|
assertEqualsM("st value", 485000, st);
|
||||||
|
|
||||||
|
// todo: why is this required here? we already have one 'prepareOutputSignals' in constructor, what's wrong with it?
|
||||||
|
prepareOutputSignals(PASS_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
|
assertEqualsM("fuel #1", 3.03, eth.engine.fuelMs);
|
||||||
InjectionEvent *ie0 = ð.engine.engineConfiguration2->injectionEvents->injectionEvents.elements[0];
|
InjectionEvent *ie0 = ð.engine.engineConfiguration2->injectionEvents->injectionEvents.elements[0];
|
||||||
assertEquals(0, ie0->injectionStart.angleOffset);
|
assertEqualsM("injection angle", 0, ie0->injectionStart.angleOffset);
|
||||||
|
|
||||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||||
assertEquals(1500, eth.engine.rpmCalculator.rpmValue);
|
assertEquals(1500, eth.engine.rpmCalculator.rpmValue);
|
||||||
|
@ -358,6 +365,7 @@ void testRpmCalculator(void) {
|
||||||
|
|
||||||
assertEqualsM("index #2", 0, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
assertEqualsM("index #2", 0, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||||
assertEqualsM("queue size/6", 6, schedulingQueue.size());
|
assertEqualsM("queue size/6", 6, schedulingQueue.size());
|
||||||
|
{
|
||||||
scheduling_s *ev0 = schedulingQueue.getForUnitText(0);
|
scheduling_s *ev0 = schedulingQueue.getForUnitText(0);
|
||||||
|
|
||||||
assertREquals((void*)ev0->callback, (void*)turnPinHigh);
|
assertREquals((void*)ev0->callback, (void*)turnPinHigh);
|
||||||
|
@ -379,6 +387,7 @@ void testRpmCalculator(void) {
|
||||||
|
|
||||||
scheduling_s *ev5 = schedulingQueue.getForUnitText(5);
|
scheduling_s *ev5 = schedulingQueue.getForUnitText(5);
|
||||||
assertEqualsLM("o 5", (long)&enginePins.injectors[0], (long)ev5->param);
|
assertEqualsLM("o 5", (long)&enginePins.injectors[0], (long)ev5->param);
|
||||||
|
}
|
||||||
|
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
|
@ -396,15 +405,40 @@ void testRpmCalculator(void) {
|
||||||
assertEqualsM("3/3", st + 14777, schedulingQueue.getForUnitText(3)->momentX);
|
assertEqualsM("3/3", st + 14777, schedulingQueue.getForUnitText(3)->momentX);
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
|
assertEquals(5, engine->triggerShape.triggerIndexByAngle[240]);
|
||||||
|
assertEquals(5, engine->triggerShape.triggerIndexByAngle[241]);
|
||||||
|
|
||||||
timeNow += 5000;
|
timeNow += 5000;
|
||||||
|
assertEqualsM("Size 4.1", 6, engine->engineConfiguration2->injectionEvents->eventsCount);
|
||||||
|
assertFalseM("No squirts expected 4.1", engine->engineConfiguration2->injectionEvents->hasEvents[4]);
|
||||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN PASS_ENGINE_PARAMETER);
|
||||||
|
assertEqualsM("queue size 4.1", 0, schedulingQueue.size());
|
||||||
|
|
||||||
timeNow += 5000; // 5ms
|
timeNow += 5000; // 5ms
|
||||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||||
|
assertEqualsM("queue size 4.2", 6, schedulingQueue.size());
|
||||||
|
|
||||||
timeNow += 5000; // 5ms
|
timeNow += 5000; // 5ms
|
||||||
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
|
||||||
|
assertEqualsM("queue size 4.3", 6, schedulingQueue.size());
|
||||||
|
|
||||||
|
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
|
||||||
|
assertEqualsM("fuel", 3.03, eth.engine.fuelMs);
|
||||||
|
assertEquals(1500, eth.engine.rpmCalculator.rpmValue);
|
||||||
|
{
|
||||||
|
scheduling_s *ev0 = schedulingQueue.getForUnitText(0);
|
||||||
|
|
||||||
|
assertREquals((void*)ev0->callback, (void*)turnPinHigh);
|
||||||
|
assertEqualsM("ev 0/2", st + 26666, ev0->momentX);
|
||||||
|
assertEqualsLM("o 0/2", (long)&enginePins.injectors[2], (long)ev0->param);
|
||||||
|
|
||||||
|
scheduling_s *ev1 = schedulingQueue.getForUnitText(1);
|
||||||
|
assertEqualsM("ev 1/2", st + 26666, ev1->momentX);
|
||||||
|
assertEqualsLM("o 1/2", (long)&enginePins.injectors[5], (long)ev1->param);
|
||||||
|
}
|
||||||
|
|
||||||
assertEqualsM("index #4", 6, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
assertEqualsM("index #4", 6, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||||
assertEqualsM("queue size 4", 6, schedulingQueue.size());
|
assertEqualsM("queue size 4", 6, schedulingQueue.size());
|
||||||
assertEqualsM("4/0", st + 26666, schedulingQueue.getForUnitText(0)->momentX);
|
|
||||||
schedulingQueue.clear();
|
schedulingQueue.clear();
|
||||||
|
|
||||||
timeNow += 5000;
|
timeNow += 5000;
|
||||||
|
|
Loading…
Reference in New Issue