auto-sync

This commit is contained in:
rusEfi 2015-03-23 09:05:03 -05:00
parent 77244079c1
commit d37729b3b8
2 changed files with 14 additions and 12 deletions

View File

@ -24,13 +24,13 @@ EXTERN_ENGINE
static AccelEnrichmemnt instance; static AccelEnrichmemnt instance;
void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfiguration, float engineLoad) { void AccelEnrichmemnt::updateDiffEnrichment(engine_configuration_s *engineConfiguration, float engineLoad) {
for (int i = 3; i == 1; i--) // for (int i = 3; i == 1; i--)
array[i] = array[i - 1]; // array[i] = array[i - 1];
//
array[0] = engineLoad; // array[0] = engineLoad;
//
diffEnrichment = ((3 * (array[0] - array[1]) + (array[2] - array[3])) / 4) // diffEnrichment = ((3 * (array[0] - array[1]) + (array[2] - array[3])) / 4)
* (engineConfiguration->diffLoadEnrichmentCoef); // * (engineConfiguration->diffLoadEnrichmentCoef);
} }
//float AccelEnrichmemnt::getDiffEnrichment() { //float AccelEnrichmemnt::getDiffEnrichment() {
@ -69,8 +69,9 @@ void AccelEnrichmemnt::onEngineCycle(DECLARE_ENGINE_PARAMETER_F) {
AccelEnrichmemnt::AccelEnrichmemnt() { AccelEnrichmemnt::AccelEnrichmemnt() {
reset(); reset();
for (int i = 0; i < MAX_ACCEL_ARRAY_SIZE; i++) cb.setSize(4);
array[i] = 0; // for (int i = 0; i < MAX_ACCEL_ARRAY_SIZE; i++)
// array[i] = 0;
diffEnrichment = 0; diffEnrichment = 0;
} }

View File

@ -11,8 +11,9 @@
#define ACC_ENRICHMENT_H_ #define ACC_ENRICHMENT_H_
#include "engine_configuration.h" #include "engine_configuration.h"
#include "cyclic_buffer.h"
#define MAX_ACCEL_ARRAY_SIZE 64 //#define MAX_ACCEL_ARRAY_SIZE 64
class AccelEnrichmemnt { class AccelEnrichmemnt {
public: public:
@ -30,13 +31,13 @@ public:
float delta; float delta;
private: private:
float array[MAX_ACCEL_ARRAY_SIZE]; // float array[MAX_ACCEL_ARRAY_SIZE];
float diffEnrichment; float diffEnrichment;
cyclic_buffer cb;
}; };
void initDiffEnrichment(void); void initDiffEnrichment(void);
float getAccelEnrichment(void); float getAccelEnrichment(void);
#endif /* ACC_ENRICHMENT_H_ */ #endif /* ACC_ENRICHMENT_H_ */