auto-sync

This commit is contained in:
rusEfi 2014-11-17 15:03:20 -06:00
parent 086c27c043
commit 58b17a8807
4 changed files with 17 additions and 11 deletions

View File

@ -182,8 +182,8 @@ float LECalculator::getValue(Engine *engine) {
return stack.pop();
}
LEElementPool::LEElementPool(int size) {
pool = thepool;
LEElementPool::LEElementPool(LEElement *pool, int size) {
this->pool = pool;
this->size = size;
reset();
}
@ -193,7 +193,7 @@ void LEElementPool::reset() {
}
LEElement *LEElementPool::next() {
if (index == LE_ELEMENT_POOL_SIZE - 1) {
if (index == size - 1) {
firmwareError("LE_ELEMENT_POOL_SIZE overflow");
return NULL;
}

View File

@ -53,12 +53,9 @@ public:
LEElement *next;
};
#define LE_ELEMENT_POOL_SIZE 256
class LEElementPool {
public:
LEElementPool(int size);
LEElement thepool[LE_ELEMENT_POOL_SIZE];
LEElementPool(LEElement *pool, int size);
LEElement *pool;
LEElement *next();
void reset();

View File

@ -57,7 +57,11 @@
LECalculator calc;
LEElementPool lePool(LE_ELEMENT_POOL_SIZE);
#define LE_ELEMENT_POOL_SIZE 256
static LEElement mainPool[LE_ELEMENT_POOL_SIZE];
LEElementPool lePool(mainPool, LE_ELEMENT_POOL_SIZE);
LEElement * fuelPumpLogic;
LEElement * radiatorFanLogic;

View File

@ -14,6 +14,8 @@
#include "cli_registry.h"
#include "engine.h"
#define TEST_POOL_SIZE 256
static float mockCoolant;
static float mockFan;
static float mockRpm;
@ -56,7 +58,8 @@ static void testParsing(void) {
assertTrue(isNumeric("123"));
assertFalse(isNumeric("a123"));
LEElementPool pool(LE_ELEMENT_POOL_SIZE);
LEElement thepool[TEST_POOL_SIZE];
LEElementPool pool(thepool, TEST_POOL_SIZE);
LEElement *element;
element = parseExpression(&pool, "1 3 AND not");
@ -80,7 +83,8 @@ static void testParsing(void) {
}
static void testExpression(const char *line, float expected) {
LEElementPool pool(LE_ELEMENT_POOL_SIZE);
LEElement thepool[TEST_POOL_SIZE];
LEElementPool pool(thepool, TEST_POOL_SIZE);
pool.reset();
LEElement * element = parseExpression(&pool, line);
print("Parsing [%s]", line);
@ -119,7 +123,8 @@ void testLogicExpressions(void) {
c.reset();
LEElementPool pool(LE_ELEMENT_POOL_SIZE);
LEElement thepool[TEST_POOL_SIZE];
LEElementPool pool(thepool, TEST_POOL_SIZE);
LEElement *e = pool.next();
e->init(LE_METHOD_TIME_SINCE_BOOT);