auto-sync

This commit is contained in:
rusEfi 2016-08-26 19:02:56 -04:00
parent d61835fa46
commit 9c80785122
9 changed files with 55 additions and 26 deletions

View File

@ -11,19 +11,6 @@
#if EFI_ENGINE_SNOW_BLOWER
#define NUMBER_OF_CYLINDERS 1
#define EFI_ENGINE_ID "Snow Blower"
#define RPM_MULT (1)
#define getCoolantTemperature() 0
#define getIntakeAirTemperature() 0
#define getMaf() 0
#define getTPS() 0
#define getAfr() 0
#endif /* EFI_ENGINE_SNOW_BLOWER */
#endif /* SNOW_BLOWER_H_ */

View File

@ -610,8 +610,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->coolantTemperature = coolant;
tsOutputChannels->intakeAirTemperature = intake;
tsOutputChannels->throttlePositon = tps;
tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMaf() : 0;
tsOutputChannels->massAirFlow = hasMafSensor() ? getRealMaf() : 0;
tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMaf(PASS_ENGINE_PARAMETER_F) : 0;
tsOutputChannels->massAirFlow = hasMafSensor() ? getRealMaf(PASS_ENGINE_PARAMETER_F) : 0;
tsOutputChannels->veValue = veMap.getValue(rpm, getMap());
tsOutputChannels->currentTargetAfr = afrMap.getValue(rpm, getMap());

View File

@ -41,7 +41,7 @@
EXTERN_ENGINE
;
static fuel_Map3D_t fuelMap("fuel");
fuel_Map3D_t fuelMap("fuel");
static fuel_Map3D_t fuelPhaseMap("fl ph");
extern fuel_Map3D_t ve2Map;
extern afr_Map3D_t afrMap;

View File

@ -24,8 +24,8 @@ public:
void init(vType table[RPM_BIN_SIZE][LOAD_BIN_SIZE], float loadBins[LOAD_BIN_SIZE], float rpmBins[RPM_BIN_SIZE]);
float getValue(float xRpm, float y);
void setAll(vType value);
private:
vType *pointers[LOAD_BIN_SIZE];
private:
float *loadBins;
float *rpmBins;
bool initialized;
@ -148,6 +148,9 @@ typedef Map3D<BARO_CORR_SIZE, BARO_CORR_SIZE, float> baroCorr_Map3D_t;
void setRpmBin(float array[], int size, float idleRpm, float topRpm);
void setTableBin(float array[], int size, float from, float to);
#define setArrayValues(array, size, value) setTableBin(array, size, value, value)
void setTableBin2(float array[], int size, float from, float to, float precision);
void setRpmTableBin(float array[], int size);

View File

@ -279,14 +279,14 @@ static void showLine(lcd_line_e line, int screenY) {
return;
case LL_MAF_V:
if (hasMafSensor()) {
lcdPrintf("MAF: %fv", getMaf());
lcdPrintf("MAF: %fv", getMaf(PASS_ENGINE_PARAMETER_F));
} else {
lcdPrintf("MAF: none");
}
return;
case LL_MAF_KG_HR:
if (hasMafSensor()) {
lcdPrintf("MAF: %f kg/hr", getRealMaf());
lcdPrintf("MAF: %f kg/hr", getRealMaf(PASS_ENGINE_PARAMETER_F));
} else {
lcdPrintf("MAF: none");
}

View File

@ -15,7 +15,7 @@
#include "main.h"
#define getMafT(ec) (getVoltageDivided("maf", ec->mafAdcChannel))
float getMaf(void);
float getMaf(DECLARE_ENGINE_PARAMETER_F);
bool hasMafSensor(DECLARE_ENGINE_PARAMETER_F);
float getRealMaf(DECLARE_ENGINE_PARAMETER_F);

View File

@ -51,7 +51,6 @@ void assertTrueM(const char *msg, float actual);
void assertFalse(float actual);
void assertFalseM(const char *msg, float actual);
float getMaf(void);
#define systicks2ms(x) (0)

View File

@ -92,6 +92,8 @@ void testMafLookup(void) {
assertEqualsM("@255", 738, engine->mafDecodingLookup[255]);
}
float unitTestValue = 0;
float getMap(void) {
return 0;
return unitTestValue;
}

View File

@ -9,7 +9,7 @@
#include "test_trigger_decoder.h"
#include "trigger_decoder.h"
#include "engine_math.h"
#include "thermistors.h"
#include "allsensors.h"
#include "ford_aspire.h"
#include "dodge_neon.h"
@ -28,8 +28,11 @@
#include "advance_map.h"
#include "engine_test_helper.h"
#include "speed_density.h"
#include "fuel_math.h"
extern int timeNow;
extern float unitTestValue;
extern float testMafValue;
extern bool printTriggerDebug;
extern float actualSynchGap;
@ -575,6 +578,8 @@ void testTriggerDecoder(void) {
testRpmCalculator();
}
extern fuel_Map3D_t fuelMap;
void testFuelSchedulerBug299(void) {
printf("*************************************************** testFuelSchedulerBug299\r\n");
EngineTestHelper eth(TEST_ENGINE);
@ -583,6 +588,11 @@ void testFuelSchedulerBug299(void) {
timeNow = 0;
schedulingQueue.clear();
setArrayValues(config->cltFuelCorrBins, CLT_CURVE_SIZE, 1);
setArrayValues(engineConfiguration->injector.battLagCorr, VBAT_INJECTOR_CURVE_SIZE, 0);
// this is needed to update injectorLag
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_F);
assertEqualsM("CLT", 70, engine->engineState.clt);
engineConfiguration->trigger.type = TT_ONE;
@ -592,10 +602,38 @@ void testFuelSchedulerBug299(void) {
assertEqualsM("RPM=0", 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
eth.fireTriggerEvents2(2, MS2US(50));
eth.fireTriggerEvents2(2, MS2US(20));
assertEqualsM("RPM", 1200, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
assertEquals(LM_PLAIN_MAF, engineConfiguration->algorithm);
assertEqualsM("fuel", 4.07, engine->fuelMs);
testMafValue = 0;
assertEqualsM("maf", 0, getMaf(PASS_ENGINE_PARAMETER_F));
assertEqualsM("iatC", 1, engine->engineState.iatFuelCorrection);
assertEqualsM("cltC", 1, engine->engineState.cltFuelCorrection);
assertEqualsM("lag", 0, engine->engineState.injectorLag);
assertEqualsM("RPM", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_F);
assertEqualsM("fuel#1", 3, engine->fuelMs);
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER));
testMafValue = 3;
assertEqualsM("maf", 3, getMaf(PASS_ENGINE_PARAMETER_F));
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
assertEquals(8, engineLoadIndex);
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 35);
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 35);
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_F);
assertEqualsM("fuel#2", 35, engine->fuelMs);
assertEqualsM("duty for maf=3", 87.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F) PASS_ENGINE_PARAMETER));
unitTestValue = 0;
testMafValue = 0;
}