auto-sync

This commit is contained in:
rusEfi 2016-01-30 22:03:36 -05:00
parent 899d15a3a6
commit 77f7ad454e
37 changed files with 242 additions and 120 deletions

View File

@ -444,8 +444,9 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
setAlgorithm(LM_SPEED_DENSITY PASS_ENGINE_PARAMETER);
boardConfiguration->alternatorControlPin = GPIOD_5;
// engineConfiguration->alternatorControl.pFactor = 22;
engineConfiguration->alternatorControl.pFactor = 55; // looks to work better, maybe time for some iFactor
engineConfiguration->targetVBatt = 14.5;
engineConfiguration->alternatorOffset = 20;
engineConfiguration->alternatorControl.pFactor = 20; // looks to work better, maybe time for some iFactor
// enableFrankensoCan();
engineConfiguration->canWriteEnabled = true;
@ -463,6 +464,10 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->suckedOffCoef = 0.05;
engineConfiguration->addedToWallCoef = 0.40;
engineConfiguration->tpsAccelEnrichmentMultiplier = 0;
engineConfiguration->suckedOffCoef = 0;
engineConfiguration->addedToWallCoef = 0;
boardConfiguration->isSdCardEnabled = false;
boardConfiguration->manIdlePosition = 40; // set_idle_pwm 40

View File

@ -148,6 +148,9 @@ void setFordAspireEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
// engineConfiguration->iat.adcChannel =
engineConfiguration->map.sensor.type = MT_DENSO183;
engineConfiguration->engineSnifferRpmThreshold = 13000;
engineConfiguration->sensorSnifferRpmThreshold = 13000;
}
#endif /* EFI_SUPPORT_FORD_ASPIRE */

View File

@ -39,7 +39,6 @@ void setMazda626EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
// chartsize 600
engineConfiguration->engineChartSize = 600;
boardConfiguration->sensorChartMode = SC_TRIGGER;
engineConfiguration->sensorChartFrequency = 2;
engineConfiguration->injector.flow = 330;

View File

@ -92,6 +92,9 @@ typedef struct {
*/
float deltaTps; // offset 116
int triggerErrorsCounter; // offset 120
/**
* Engine load delta
*/
float engineLoadAccelDelta; // offset 124
float tpsAccelFuel; // offset 128
float baroCorrection;
@ -111,12 +114,12 @@ typedef struct {
float runningFuel; // 188
int debugIntField1; // 192
float injectorLagMs; // 196
float debugFloatField2;
float debugFloatField3;
float debugFloatField4;
float debugFloatField5;
int debugIntField2;
int debugIntField3;
float debugFloatField2; // 200
float debugFloatField3; // 204
float debugFloatField4; // 208
float debugFloatField5; // 212
int debugIntField2; // 216
int debugIntField3; // 220
int unused3[13];
} TunerStudioOutputChannels;

View File

@ -593,7 +593,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->manifoldAirPressure = getMap();
tsOutputChannels->engineLoad = engineLoad;
tsOutputChannels->rpmAcceleration = engine->rpmCalculator.getRpmAcceleration();
tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta();
tsOutputChannels->triggerErrorsCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter;
tsOutputChannels->baroCorrection = engine->engineState.baroCorrection;
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->runningFuel = ENGINE(engineState.runningFuel);
tsOutputChannels->injectorLagMs = ENGINE(injectorLagMs);
tsOutputChannels->wallFuelAmount = wallFuel.getWallFuel(0);
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;
// engine load acceleration
tsOutputChannels->engineLoadAccelDelta = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_ENGINE_PARAMETER_F) * 100 / getMap();
tsOutputChannels->iatCorrection = ENGINE(engineState.iatFuelCorrection);
tsOutputChannels->cltCorrection = ENGINE(engineState.cltFuelCorrection);

View File

@ -59,6 +59,10 @@ int MockAdcState::getMockAdcValue(int hwChannel) {
* See also periodicFastCallback
*/
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.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_F);
@ -88,6 +92,8 @@ void Engine::addConfigurationListener(configuration_callback_t callback) {
Engine::Engine(persistent_config_s *config) {
init(config);
isEngineChartEnabled = false;
sensorChartMode = SC_OFF;
/**
* 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);
// 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() {

View File

@ -162,6 +162,9 @@ public:
*/
floatms_t runningFuel;
/**
* TPS acceleration: extra fuel amount
*/
floatms_t tpsAccelEnrich;
angle_t injectionOffset;
@ -223,7 +226,14 @@ public:
* That's the list of pending spark firing events
*/
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;
persistent_config_s *config;
@ -235,6 +245,9 @@ public:
*/
efitick_t stopEngineRequestTimeNt;
/**
* always 360 or 720, never zero
*/
angle_t engineCycle;
AccelEnrichmemnt engineLoadAccelEnrichment;

View File

@ -382,6 +382,9 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
engineConfiguration->step1SparkCutEnable = false;
engineConfiguration->step1RpmWindow = 500;
engineConfiguration->slowAdcAlpha = 1;
engineConfiguration->engineSnifferRpmThreshold = 2500;
engineConfiguration->sensorSnifferRpmThreshold = 2500;
engineConfiguration->rpmHardLimit = 7000;
engineConfiguration->cranking.rpm = 550;
engineConfiguration->cutFuelOnHardLimit = true;

View File

@ -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
#ifndef ENGINE_CONFIGURATION_GENERATED_H_
#define ENGINE_CONFIGURATION_GENERATED_H_
@ -753,9 +753,10 @@ typedef struct {
*/
engine_type_e engineType;
/**
* Disable engine sniffer above this rpm
* offset 4
*/
int unusedOffset4;
int engineSnifferRpmThreshold;
/**
* offset 8
*/
@ -854,9 +855,10 @@ typedef struct {
*/
float cylinderBore;
/**
* Disable sensor sniffer above this rpm
* offset 416
*/
int unused34234;
int sensorSnifferRpmThreshold;
/**
* offset 420
*/
@ -1461,7 +1463,11 @@ typedef struct {
/**
* offset 2240
*/
int unused[194];
float slowAdcAlpha;
/**
* offset 2244
*/
int unused[193];
/** total size 3016*/
} engine_configuration_s;
@ -1611,4 +1617,4 @@ typedef struct {
#endif
// 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

View File

@ -27,8 +27,8 @@
#define engineConfiguration_offset_hex 0
#define engineType_offset 0
#define engineType_offset_hex 0
#define unusedOffset4_offset 4
#define unusedOffset4_offset_hex 4
#define engineSnifferRpmThreshold_offset 4
#define engineSnifferRpmThreshold_offset_hex 4
#define injector_offset 8
#define injector_offset_hex 8
#define injector_flow_offset 8
@ -127,7 +127,7 @@
#define firingOrder_offset 408
#define firingOrder_offset_hex 198
#define cylinderBore_offset 412
#define unused34234_offset 416
#define sensorSnifferRpmThreshold_offset 416
#define rpmHardLimit_offset 420
#define algorithm_offset 424
#define crankingInjectionMode_offset 428
@ -730,7 +730,8 @@
#define uartConsoleSerialSpeed_offset 2228
#define tpsDecelEnleanmentThreshold_offset 2232
#define tpsDecelEnleanmentMultiplier_offset 2236
#define unused_offset 2240
#define slowAdcAlpha_offset 2240
#define unused_offset 2244
#define le_formulas1_offset 3016
#define le_formulas2_offset 3216
#define le_formulas3_offset 3416

View File

@ -73,12 +73,12 @@ void turnPinHigh(NamedOutputPin *output) {
#endif
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
// 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'
const char *pinName = output->name;
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
addWaveChartEvent(pinName, WC_UP);
addEngineSniffferEvent(pinName, WC_UP);
}
#endif /* EFI_ENGINE_SNIFFER */
// dbgDurr = hal_lld_get_counter_value() - dbgStart;
@ -98,11 +98,11 @@ void turnPinLow(NamedOutputPin *output) {
#endif /* EFI_DEFAILED_LOGGING */
#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'
const char *pinName = output->name;
addWaveChartEvent(pinName, WC_DOWN);
addEngineSniffferEvent(pinName, WC_DOWN);
}
#endif /* EFI_ENGINE_SNIFFER */
}
@ -117,7 +117,7 @@ int getRevolutionCounter(void);
*
*/
void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayUs, float durationUs, NamedOutputPin *output) {
#if EFI_GPIO
#if EFI_GPIO || defined(__DOXYGEN__)
if (durationUs < 0) {
warning(OBD_PCM_Processor_Fault, "duration cannot be negative: %d", durationUs);
return;
@ -131,6 +131,9 @@ void scheduleOutput(OutputSignal *signal, efitimeus_t nowUs, float delayUs, floa
int index = getRevolutionCounter() % 2;
scheduling_s * sUp = &signal->signalTimerUp[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 down", sDown, nowUs + (int) (delayUs + durationUs), (schfunc_t) &turnPinLow, output);

View File

@ -51,19 +51,22 @@ void chDbgPanic3(const char *msg, const char * file, int line) {
static char warningBuffer[WARNING_BUFFER_SIZE];
static MemoryStream warningStream;
static int warningCounter = 0;
/**
* OBD_PCM_Processor_Fault is the general error code for now
*
* @returns TRUE in case there are too many warnings
*/
int warning(obd_code_e code, const char *fmt, ...) {
UNUSED(code);
UNUSED(code);
int now = getTimeNowSeconds();
if (absI(now - timeOfPreviousWarning) < 10 || !warningEnabled)
return true; // we just had another warning, let's not spam
timeOfPreviousWarning = now;
warningCounter++;
resetLogging(&logger); // todo: is 'reset' really needed here?
appendMsgPrefix(&logger);

View File

@ -11,7 +11,7 @@
#include "engine.h"
#define FLASH_DATA_VERSION 9000
#define FLASH_DATA_VERSION 9052
void readFromFlash(void);
void initFlash(Logging *sharedLogger);

View File

@ -108,7 +108,7 @@ static void startAveraging(void *arg) {
* as fast as possible
*/
void mapAveragingCallback(adcsample_t adcValue) {
if (!isAveraging && boardConfiguration->sensorChartMode != SC_MAP) {
if (!isAveraging && ENGINE(sensorChartMode) != SC_MAP) {
return;
}
@ -117,7 +117,7 @@ void mapAveragingCallback(adcsample_t adcValue) {
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#9a");
#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
== 0) {
float voltage = adcToVoltsDivided(adcValue);

View File

@ -156,6 +156,10 @@ void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle,
efiAssertVoid(TRIGGER_SHAPE(getSize()) > 0, "uninitialized TriggerShape");
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]) {
hasEvents[ev->injectionStart.eventIndex] = true;
eventsCount++;

View File

@ -319,7 +319,7 @@ void setEngineType(int value) {
resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER);
#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__)
if (engine->isTestMode)
waveChart.resetWaveChart();
waveChart.reset();
#endif
#if EFI_INTERNAL_FLASH

View File

@ -151,6 +151,10 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int eventIndex, bool limitedF
(schfunc_t) &endSimultaniousInjection, engine);
} 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);
}
}
@ -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
*/
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'
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
@ -241,7 +248,11 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t eventInde
*/
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset;
scheduleTask("spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnPinLow, iEvent->output);
#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);
} else {
/**
* Spark should be scheduled in relation to some future trigger event, this way we get better firing precision
@ -318,9 +329,6 @@ uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
#endif
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();
/**
@ -355,7 +363,7 @@ static ALWAYS_INLINE void scheduleIgnitionAndFuelEvents(int rpm, int revolutionI
initializeIgnitionActions(ENGINE(engineState.timingAdvance), ENGINE(engineState.dwellAngle), list PASS_ENGINE_PARAMETER);
engine->m.ignitionSchTime = GET_TIMESTAMP() - engine->m.beforeIgnitionSch;
engine->prepareFuelSchedule(PASS_ENGINE_PARAMETER_F);
// engine->prepareFuelSchedule(PASS_ENGINE_PARAMETER_F);
}
/**

View File

@ -167,7 +167,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
angle_t crankAngle = NAN;
int signal = -1;
if (boardConfiguration->sensorChartMode == SC_TRIGGER) {
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
crankAngle = getCrankshaftAngleNt(nowNt PASS_ENGINE_PARAMETER);
signal = 1000 * ckpSignalType + index;
}
@ -175,7 +175,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
if (index != 0) {
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
if (boardConfiguration->sensorChartMode == SC_TRIGGER) {
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
scAddData(crankAngle, signal);
}
#endif
@ -204,7 +204,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
rpmState->onNewEngineCycle();
rpmState->lastRpmEventTimeNt = nowNt;
#if EFI_SENSOR_CHART || defined(__DOXYGEN__)
if (boardConfiguration->sensorChartMode == SC_TRIGGER) {
if (ENGINE(sensorChartMode) == SC_TRIGGER) {
scAddData(crankAngle, signal);
}
#endif
@ -222,7 +222,7 @@ static char rpmBuffer[10];
*/
static void onTdcCallback(void) {
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) {
(void) ckpSignalType;
bool isTriggerSynchronizationPoint = index0 == 0;
if (isTriggerSynchronizationPoint
&& engineConfiguration->isEngineChartEnabled) {
if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) {
int revIndex2 = engine->rpmCalculator.getRevolutionCounter() % 2;
int rpm = getRpmE(engine);
// todo: use event-based scheduling, not just time-based scheduling

View File

@ -96,9 +96,9 @@ bool isCranking(void);
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
#if EFI_ENGINE_SNIFFER
#define addWaveChartEvent(name, msg) waveChart.addWaveChartEvent3((name), (msg))
#define addEngineSniffferEvent(name, msg) waveChart.addEvent3((name), (msg))
#else
#define addWaveChartEvent(n, msg) {}
#define addEngineSniffferEvent(n, msg) {}
#endif /* EFI_ENGINE_SNIFFER */
void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, schfunc_t callback, void *param, RpmCalculator *calc);

View File

@ -118,11 +118,11 @@ static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType,
bool isUp = isUpEvent[(int) ckpSignalType];
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) {
// let's add the opposite event right away
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);
}
}

View File

@ -217,7 +217,11 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
float prevGap = 1.0 * toothed_previous_duration / durationBeforePrevious;
float gap3 = 1.0 * durationBeforePrevious / thirdPreviousDuration;
#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
actualSynchGap = gap;
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]);
// todo: make this '90' depend on cylinder count?
angle_t prevAngle = currentAngle - 90;

View File

@ -116,7 +116,7 @@ void setTriggerEmulatorRPM(int rpm, Engine *engine) {
}
#if EFI_ENGINE_SNIFFER
if (engine->isTestMode)
waveChart.resetWaveChart();
waveChart.reset();
#endif /* EFI_ENGINE_SNIFFER */
scheduleMsg(logger, "Emulating position sensor(s). RPM=%d", rpm);

View File

@ -39,7 +39,7 @@
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
#include "rfiutil.h"
#include "histogram.h"
static histogram_s waveChartHisto;
static histogram_s engineSnifferHisto;
#endif
EXTERN_ENGINE
@ -73,13 +73,13 @@ static uint32_t skipUntilEngineCycle = 0;
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
extern WaveChart waveChart;
static void resetWaveChartNow(void) {
static void resetNow(void) {
skipUntilEngineCycle = engine->rpmCalculator.getRevolutionCounter() + 3;
waveChart.resetWaveChart();
waveChart.reset();
}
#endif
void WaveChart::resetWaveChart() {
void WaveChart::reset() {
#if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "reset while at ", counter);
#endif /* DEBUG_WAVE */
@ -102,7 +102,7 @@ bool WaveChart::isStartedTooLongAgo() {
return startTimeNt != 0 && NT2US(chartDurationNt) > engineConfiguration->engineChartSize * 1000000 / 20;
}
bool WaveChart::isWaveChartFull() {
bool WaveChart::isFull() {
return counter >= engineConfiguration->engineChartSize;
}
@ -125,10 +125,10 @@ void setChartSize(int newSize) {
printStatus();
}
void WaveChart::publishChartIfFull() {
if (isWaveChartFull() || isStartedTooLongAgo()) {
publishChart();
resetWaveChart();
void WaveChart::publishIfFull() {
if (isFull() || isStartedTooLongAgo()) {
publish();
reset();
}
}
@ -141,10 +141,10 @@ WaveChart::WaveChart() {
void WaveChart::init() {
initLoggingExt(&logging, "wave chart", WAVE_LOGGING_BUFFER, sizeof(WAVE_LOGGING_BUFFER));
isInitialized = true;
resetWaveChart();
reset();
}
void WaveChart::publishChart() {
void WaveChart::publish() {
appendPrintf(&logging, DELIMETER);
waveChartUsedSize = loggingSize(&logging);
#if DEBUG_WAVE
@ -152,7 +152,7 @@ void WaveChart::publishChart() {
scheduleSimpleMsg(&debugLogging, "IT'S TIME", strlen(l->buffer));
#endif
bool isFullLog = getFullLog();
if (engineConfiguration->isEngineChartEnabled && isFullLog) {
if (ENGINE(isEngineChartEnabled) && isFullLog) {
scheduleLogging(&logging);
}
}
@ -162,11 +162,11 @@ static char timeBuffer[10];
/**
* @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)
return;
efiAssertVoid(name!=NULL, "WC: NULL name");
if (!engineConfiguration->isEngineChartEnabled) {
if (!ENGINE(isEngineChartEnabled)) {
return;
}
@ -178,7 +178,7 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
#if DEBUG_WAVE
scheduleSimpleMsg(&debugLogging, "current", chart->counter);
#endif
if (isWaveChartFull()) {
if (isFull()) {
return;
}
@ -229,7 +229,7 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
#if EFI_HISTOGRAMS && EFI_PROD_CODE
int64_t diff = hal_lld_get_counter_value() - beforeCallback;
if (diff > 0) {
hsAdd(&waveChartHisto, diff);
hsAdd(&engineSnifferHisto, diff);
}
#endif /* EFI_HISTOGRAMS */
@ -237,16 +237,11 @@ void WaveChart::addWaveChartEvent3(const char *name, const char * msg) {
void showWaveChartHistogram(void) {
#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__)
printHistogram(&logger, &waveChartHisto);
printHistogram(&logger, &engineSnifferHisto);
#endif
}
void initWaveChart(WaveChart *chart) {
if (!engineConfiguration->isEngineChartEnabled) {
printMsg(&logger, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! chart disabled");
}
/**
* constructor does not work because we need specific initialization order
*/
@ -259,13 +254,13 @@ void initWaveChart(WaveChart *chart) {
#endif
#if EFI_HISTOGRAMS || defined(__DOXYGEN__)
initHistogram(&waveChartHisto, "wave chart");
initHistogram(&engineSnifferHisto, "wave chart");
#endif /* EFI_HISTOGRAMS */
addConsoleActionI("chartsize", setChartSize);
addConsoleActionI("chart", setChartActive);
#if ! EFI_UNIT_TEST || defined(__DOXYGEN__)
addConsoleAction("reset_engine_chart", resetWaveChartNow);
addConsoleAction("reset_engine_chart", resetNow);
#endif
}

View File

@ -21,12 +21,12 @@ class WaveChart {
public:
WaveChart();
void init();
void publishChart();
void resetWaveChart();
bool isWaveChartFull();
void addEvent3(const char *name, const char *msg);
void reset();
void publishIfFull();
void publish();
bool isFull();
bool isStartedTooLongAgo();
void publishChartIfFull();
void addWaveChartEvent3(const char *name, const char *msg);
private:
Logging logging;
uint32_t counter;

View File

@ -59,7 +59,7 @@ static void waAnaWidthCallback(WaveReader *reader) {
efitick_t nowUs = getTimeNowUs();
reader->eventCounter++;
reader->lastActivityTimeUs = nowUs;
addWaveChartEvent(reader->name, WC_UP);
addEngineSniffferEvent(reader->name, WC_UP);
uint32_t width = nowUs - reader->periodEventTimeUs;
reader->last_wave_low_widthUs = width;
@ -72,7 +72,7 @@ void WaveReader::onFallEvent() {
efitick_t nowUs = getTimeNowUs();
eventCounter++;
lastActivityTimeUs = nowUs;
addWaveChartEvent(name, WC_DOWN);
addEngineSniffferEvent(name, WC_DOWN);
efitick_t width = nowUs - widthEventTimeUs;
last_wave_high_widthUs = width;
@ -158,7 +158,7 @@ static THD_FUNCTION(waThread, arg) {
while (TRUE) {
chThdSleepSeconds(CHART_RESET_DELAY);
waveChart.publishChartIfFull();
waveChart.publishIfFull();
}
#endif /* EFI_ENGINE_SNIFFER */
}

View File

@ -3,7 +3,7 @@
* @brief Low level ADC code
*
* 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
*
@ -43,9 +43,9 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) {
// 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: 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_PERIOD_SLOW 500 /* PWM period (in PWM ticks). */
#define PWM_PERIOD_SLOW 250 /* PWM period (in PWM ticks). */
/**
* 8000 RPM is 133Hz
@ -62,6 +62,7 @@ AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) {
// is there a reason to have this configurable?
#define ADC_FAST_DEVICE ADCD2
static int slowAdcCounter = 0;
static char LOGGING_BUFFER[500];
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.*/
for (int i = 0; i < slowAdc.size(); i++) {
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++;
}
}

View File

@ -37,6 +37,8 @@ static const char * msg;
static char buff[32];
static int timerFreezeCounter = 0;
extern bool hasFirmwareErrorFlag;
/**
@ -44,7 +46,15 @@ extern bool hasFirmwareErrorFlag;
* This function should be invoked under kernel lock which would disable interrupts.
*/
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
efiAssertVoid(timeUs > 0, "not positive timeUs");
efiAssertVoid(timeUs < 10 * US_PER_SECOND, "setHardwareUsTimer() too large");

View File

@ -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"
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
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
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
@ -630,7 +630,8 @@ baro_corr_table_t baroCorrTable;
uint32_t uartConsoleSerialSpeed;;"BPs", 1, 0, 0,1000000, 0
float tpsDecelEnleanmentThreshold;;"roc", 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

View File

@ -275,5 +275,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20160125;
return 20160128;
}

View File

@ -1,5 +1,5 @@
// 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
#define VCS_VERSION "9358"
#define VCS_VERSION "9438"
#endif

View File

@ -41,12 +41,12 @@ enable2ndByteCanID = false
; see PAGE_0_SIZE in C source code
; CONFIG_DEFINITION_START
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 22 12:32:32 EST 2016
; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jan 29 20:39:58 EST 2016
pageSize = 16088
page = 1
engineType = bits, S32, 0, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
;skipping unusedOffset4 offset 4
engineSnifferRpmThreshold = scalar, S32, 4, "RPM", 1, 0, 0,30000, 0
injector_flow = scalar, F32, 8, "cm3/min", 1, 0, 0, 1000, 2
injector_lag = scalar, F32, 12, "msec", 1, 0, -10, 25.50, 2
injector_battLagCorrBins = array, F32, 16, [8], "V", 1, 0, 0.0, 20.0, 2
@ -96,7 +96,7 @@ page = 1
cylindersCount = bits, U32, 404, [0:3], "INVALID", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, "INVALID", "INVALID", "INVALID"
firingOrder = bits, U32, 408, [0:3], "One Cylinder", "1-3-4-2", "1-2-4-3", "1-3-2-4", "1-5-3-6-2-4", "1-8-4-3-6-5-7-2", "1-5-3-6-2-4", "1-4-2-5-3-6", "1-2", "1_2_3_4_5_6", "1-2-3", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID"
;skipping cylinderBore offset 412
;skipping unused34234 offset 416
sensorSnifferRpmThreshold = scalar, S32, 416, "RPM", 1, 0, 0,30000, 0
rpmHardLimit = scalar, S32, 420, "rpm", 1, 0, 0, 20000.0, 2
algorithm = bits, U32, 424, [0:1], "MAF", "Alpha-N/TPS", "MAP", "SPEED DENSITY"
crankingInjectionMode = bits, U32, 428, [0:1], "Simultaneous", "Sequential", "Batch", "INVALID"
@ -518,7 +518,8 @@ page = 1
uartConsoleSerialSpeed = scalar, U32, 2228, "BPs", 1, 0, 0,1000000, 0
tpsDecelEnleanmentThreshold = scalar, F32, 2232, "roc", 1, 0, 0, 200, 3
tpsDecelEnleanmentMultiplier = scalar, F32, 2236, "coeff", 1, 0, 0, 200, 3
;skipping unused offset 2240
slowAdcAlpha = scalar, F32, 2240, "coeff", 1, 0, 0, 200, 3
;skipping unused offset 2244
le_formulas1 = array, U08, 3016, [200],"char", 1, 0, 0.0, 3.0, 2
le_formulas2 = array, U08, 3216, [200],"char", 1, 0, 0.0, 3.0, 2
le_formulas3 = array, U08, 3416, [200],"char", 1, 0, 0.0, 3.0, 2
@ -614,7 +615,7 @@ page = 1
[OutputChannels]
; see TS_FILE_VERSION in firmware code
fileVersion = { 20151201 }
fileVersion = { 20160122 }
ochGetCommand = "O"
@ -1010,17 +1011,19 @@ fileVersion = { 20151201 }
entry = pulseWidth, "injPulse", float, "%.3f"
entry = baseFuel, "fuel: base", float, "%.2f"
entry = veValue, "fuel: VE", float, "%.3f"
entry = engineLoadAccelDelta, "fuel: EL accel",float, "%.3f"
entry = engineLoadAccelDelta, "fuel: EL delta",float, "%.3f"
entry = deltaTps, "fuel: tps delta",float, "%.3f"
entry = tpsAccelFuel, "fuel: tpsAccel", float, "%.3f"
entry = iatCorrection, "fuel: IAT corr", float, "%.3f"
entry = wallFuelCorrection,"fuel: wall corr ms", float, "%.3f"
entry = wallFuelAmount, "fuel: wall amout", float, "%.3f"
entry = wallFuelAmount, "fuel: wall amount", float, "%.3f"
entry = baroCorrection, "baroCorrection",float,"%.3f"
entry = debugFloatField, "debug f",float,"%.3f"
entry = debugIntField, "debug i",int,"%d"
entry = tCharge, "tCharge",float,"%.3f"
; tpsADC = U16, "ADC",
; alignmet = U16, "al",
@ -1384,6 +1387,7 @@ fileVersion = { 20151201 }
field = "MAF ADC input", mafAdcChannel
field = "Baro ADC input", baroSensor_hwChannel
field = "Analog divider", analogInputDividerCoefficient
field = "slow EXP Alpha", slowAdcAlpha
dialog = tachSettings, "Analog tachometer output"
field = "pin", tachOutputPin

View File

@ -1,6 +1,6 @@
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 static final int LE_COMMAND_LENGTH = 200;
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 engineType_offset = 0;
public static final int engineType_offset_hex = 0;
public static final int unusedOffset4_offset = 4;
public static final int unusedOffset4_offset_hex = 4;
public static final int engineSnifferRpmThreshold_offset = 4;
public static final int engineSnifferRpmThreshold_offset_hex = 4;
public static final int injector_offset = 8;
public static final int injector_offset_hex = 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_hex = 198;
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 algorithm_offset = 424;
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 tpsDecelEnleanmentThreshold_offset = 2232;
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_formulas2_offset = 3216;
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 TOTAL_CONFIG_SIZE = 16088;
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_LAG = Field.create("INJECTOR_LAG", 12, FieldType.FLOAT);
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 FIRINGORDER = Field.create("FIRINGORDER", 408, FieldType.INT);
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 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);
@ -1258,6 +1259,7 @@ public class Fields {
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 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_FORMULAS2 = Field.create("LE_FORMULAS2", 3216, FieldType.INT);
public static final Field LE_FORMULAS3 = Field.create("LE_FORMULAS3", 3416, FieldType.INT);

View File

@ -90,13 +90,13 @@ public enum Sensor {
DWELL(SensorCategory.OPERATIONS, FieldType.FLOAT, 60, BackgroundColor.MUD, 1, 10),
CURRENT_VE(SensorCategory.FUEL, FieldType.FLOAT, 112, BackgroundColor.MUD),
TPS_DELTA(SensorCategory.FUEL, FieldType.FLOAT, 116, BackgroundColor.MUD),
ENGINE_LOAD_ACCEL_DELTA(SensorCategory.FUEL, FieldType.FLOAT, 124, BackgroundColor.MUD),
TPS_ACCEL_FUEL(SensorCategory.FUEL, FieldType.FLOAT, 128, BackgroundColor.MUD),
deltaTps(SensorCategory.FUEL, FieldType.FLOAT, 116, BackgroundColor.MUD),
engineLoadAccelDelta(SensorCategory.FUEL, FieldType.FLOAT, 124, BackgroundColor.MUD),
tpsAccelFuel(SensorCategory.FUEL, FieldType.FLOAT, 128, 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),
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),
TARGET_AFR(SensorCategory.OPERATIONS, FieldType.FLOAT, 176, 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"),
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_3_4_DELTA("inj 3-4 delta", SensorCategory.SNIFFING),
;

View File

@ -110,8 +110,8 @@ public class FormulasPane {
@NotNull
private String getAccelerationVariables(ConfigurationImage ci) {
String tpsDelta = oneDecimal(Sensor.TPS_DELTA);
String elDelta = oneDecimal(Sensor.ENGINE_LOAD_ACCEL_DELTA);
String tpsDelta = oneDecimal(Sensor.deltaTps);
String elDelta = oneDecimal(Sensor.engineLoadAccelDelta);
int tpsEnrichLength = ConfigField.getIntValue(ci, Fields.TPSACCELLENGTH);
int elEnrichLength = ConfigField.getIntValue(ci, Fields.ENGINELOADACCELLENGTH);
@ -121,7 +121,7 @@ public class FormulasPane {
double tpsAccelThreshold = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTTHRESHOLD);
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 tpsDecelMult = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTMULTIPLIER);
@ -179,7 +179,7 @@ public class FormulasPane {
String IATcorr = oneDecimal(Sensor.iatCorrection);
String CLTcorr = oneDecimal(Sensor.cltCorrection);
String tpsAccel = oneDecimal(Sensor.TPS_ACCEL_FUEL);
String tpsAccel = oneDecimal(Sensor.tpsAccelFuel);
String runningFuel = oneDecimal(Sensor.runningFuel);

View File

@ -132,7 +132,7 @@ public class FuelTunePane {
double engineLoad = sc.getValue(Sensor.MAP);
double afr = sc.getValue(Sensor.AFR);
// 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);
// if (clt < 80)
// return;

View File

@ -318,6 +318,9 @@ void testRpmCalculator(void) {
timeNow = 0;
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);
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
@ -341,10 +344,14 @@ void testRpmCalculator(void) {
int st = timeNow;
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);
assertEqualsM("fuel #1", 3.03, eth.engine.fuelMs);
InjectionEvent *ie0 = &eth.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);
assertEquals(1500, eth.engine.rpmCalculator.rpmValue);
@ -358,6 +365,7 @@ void testRpmCalculator(void) {
assertEqualsM("index #2", 0, eth.engine.triggerCentral.triggerState.getCurrentIndex());
assertEqualsM("queue size/6", 6, schedulingQueue.size());
{
scheduling_s *ev0 = schedulingQueue.getForUnitText(0);
assertREquals((void*)ev0->callback, (void*)turnPinHigh);
@ -379,6 +387,7 @@ void testRpmCalculator(void) {
scheduling_s *ev5 = schedulingQueue.getForUnitText(5);
assertEqualsLM("o 5", (long)&enginePins.injectors[0], (long)ev5->param);
}
schedulingQueue.clear();
@ -396,15 +405,40 @@ void testRpmCalculator(void) {
assertEqualsM("3/3", st + 14777, schedulingQueue.getForUnitText(3)->momentX);
schedulingQueue.clear();
assertEquals(5, engine->triggerShape.triggerIndexByAngle[240]);
assertEquals(5, engine->triggerShape.triggerIndexByAngle[241]);
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);
assertEqualsM("queue size 4.1", 0, schedulingQueue.size());
timeNow += 5000; // 5ms
eth.engine.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP PASS_ENGINE_PARAMETER);
assertEqualsM("queue size 4.2", 6, schedulingQueue.size());
timeNow += 5000; // 5ms
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("queue size 4", 6, schedulingQueue.size());
assertEqualsM("4/0", st + 26666, schedulingQueue.getForUnitText(0)->momentX);
schedulingQueue.clear();
timeNow += 5000;

View File

@ -109,7 +109,7 @@ void rusEfiFunctionalTest(void) {
void printPendingMessages(void) {
updateDevConsoleState(engine);
waveChart.publishChartIfFull();
waveChart.publishIfFull();
}
int isSerialOverTcpReady;