auto-sync
This commit is contained in:
parent
a32faee250
commit
a2e1dbc1f1
|
@ -53,7 +53,7 @@ Engine::Engine() {
|
|||
isRunningPwmTest = false;
|
||||
}
|
||||
|
||||
void Engine::precalc(engine_configuration_s *engineConfiguration) {
|
||||
void Engine::precalc() {
|
||||
sparkTable.preCalc(engineConfiguration->sparkDwellBins,
|
||||
engineConfiguration->sparkDwell);
|
||||
|
||||
|
@ -61,8 +61,8 @@ void Engine::precalc(engine_configuration_s *engineConfiguration) {
|
|||
float volts = i / MAF_DECODING_CACHE_MULT;
|
||||
float maf = interpolate2d(volts, engineConfiguration->mafDecodingBins,
|
||||
engineConfiguration->mafDecoding, MAF_DECODING_COUNT);
|
||||
mafDecodingLookup[i] = maf;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Engine::init() {
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
*/
|
||||
float mafDecodingLookup[MAF_DECODING_CACHE_SIZE];
|
||||
|
||||
void precalc(engine_configuration_s *engineConfiguration);
|
||||
void precalc();
|
||||
|
||||
void updateSlowSensors();
|
||||
void watchdog();
|
||||
|
|
|
@ -27,7 +27,7 @@ FastInterpolation::FastInterpolation(float x1, float y1, float x2, float y2) {
|
|||
|
||||
void FastInterpolation::init(float x1, float y1, float x2, float y2) {
|
||||
if (x1 == x2) {
|
||||
firmwareError("Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
firmwareError("init: Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
return;
|
||||
}
|
||||
a = INTERPOLATION_A(x1, y1, x2, y2);
|
||||
|
@ -52,7 +52,7 @@ float FastInterpolation::getValue(float x) {
|
|||
float interpolate(float x1, float y1, float x2, float y2, float x) {
|
||||
// todo: double comparison using EPS
|
||||
if (x1 == x2) {
|
||||
firmwareError("Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
firmwareError("interpolate: Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
return NAN;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ void Table2D<SIZE>::preCalc(float *bin, float *values) {
|
|||
float x1 = bin[i];
|
||||
float x2 = bin[i + 1];
|
||||
if (x1 == x2) {
|
||||
firmwareError("Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
firmwareError("preCalc: Same x1 and x2 in interpolate: %f/%f", x1, x2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F) {
|
|||
|
||||
void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
|
||||
for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
|
||||
engineConfiguration->sparkDwellBins[i] = 0;
|
||||
engineConfiguration->sparkDwellBins[i] = -10 + i;
|
||||
engineConfiguration->sparkDwell[i] = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,35 @@
|
|||
#include "adc_inputs.h"
|
||||
#include "maf.h"
|
||||
|
||||
EXTERN_ENGINE;
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
float getMaf(DECLARE_ENGINE_PARAMETER_F) {
|
||||
return getMafT(engineConfiguration);
|
||||
}
|
||||
|
||||
void setBosch0280218037(engine_configuration_s *engineConfiguration) {
|
||||
int i = 0;
|
||||
engineConfiguration->mafDecoding[i] = -34.5;
|
||||
engineConfiguration->mafDecodingBins[i++] = 0;
|
||||
|
||||
engineConfiguration->mafDecoding[i] = -6;
|
||||
engineConfiguration->mafDecodingBins[i++] = 0.78125;
|
||||
|
||||
engineConfiguration->mafDecoding[i] = 10.5;
|
||||
engineConfiguration->mafDecodingBins[i++] = 1.38671875;
|
||||
|
||||
engineConfiguration->mafDecoding[i] = 105.3;
|
||||
engineConfiguration->mafDecodingBins[i++] = 2.91015625;
|
||||
|
||||
engineConfiguration->mafDecoding[i] = 387.5;
|
||||
engineConfiguration->mafDecodingBins[i++] = 4.2578125;
|
||||
|
||||
engineConfiguration->mafDecoding[i] = 738;
|
||||
engineConfiguration->mafDecodingBins[i++] = 4.98046875;
|
||||
|
||||
while (i < MAF_DECODING_COUNT) {
|
||||
engineConfiguration->mafDecoding[i] = 738;
|
||||
engineConfiguration->mafDecodingBins[i++] = 4.98046875 + i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
|
||||
#define getMafT(ec) (getVoltageDivided(ec->mafAdcChannel))
|
||||
float getMaf(void);
|
||||
void setBosch0280218037(engine_configuration_s *engineConfiguration);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,6 +142,7 @@ int main(void) {
|
|||
testIdleController();
|
||||
|
||||
testMenuTree();
|
||||
testMafLookup();
|
||||
|
||||
// resizeMap();
|
||||
printf("Success 20150207\r\n");
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "map.h"
|
||||
#include "speed_density.h"
|
||||
#include "engine_test_helper.h"
|
||||
#include "maf.h"
|
||||
|
||||
void testIgnitionPlanning(void) {
|
||||
printf("*************************************************** testIgnitionPlanning\r\n");
|
||||
|
@ -22,11 +23,13 @@ void testIgnitionPlanning(void) {
|
|||
assertEquals(IM_BATCH, engineConfiguration->injectionMode);
|
||||
}
|
||||
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
|
||||
void testEngineMath(void) {
|
||||
printf("*************************************************** testEngineMath\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||
Engine * engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
|
||||
engineConfiguration->rpmMultiplier = 0.5;
|
||||
|
||||
assertEqualsM("600 RPM", 50, getOneDegreeTimeMs(600) * 180);
|
||||
|
@ -43,6 +46,22 @@ void testEngineMath(void) {
|
|||
assertEquals(327.6667, getTCharge(4000, 100, 300, 350));
|
||||
}
|
||||
|
||||
void testMafLookup(void) {
|
||||
printf("*************************************************** testMafLookup\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||
Engine * engine = ð.engine;
|
||||
engine_configuration_s *engineConfiguration = engine->engineConfiguration;
|
||||
setBosch0280218037(engineConfiguration);
|
||||
engine->precalc();
|
||||
|
||||
assertEqualsM("@0", -34.5000, engine->mafDecodingLookup[0]);
|
||||
assertEqualsM("@1", -33.7875, engine->mafDecodingLookup[1]);
|
||||
assertEqualsM("@2", -33.0750, engine->mafDecodingLookup[2]);
|
||||
assertEqualsM("@200", 313.8826, engine->mafDecodingLookup[200]);
|
||||
assertEqualsM("@255", 738, engine->mafDecodingLookup[255]);
|
||||
}
|
||||
|
||||
float getMap(void) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,5 +10,6 @@
|
|||
|
||||
void testEngineMath(void);
|
||||
void testIgnitionPlanning(void);
|
||||
void testMafLookup(void);
|
||||
|
||||
#endif /* TEST_ENGINE_MATH_H_ */
|
||||
|
|
Loading…
Reference in New Issue