auto-sync
This commit is contained in:
parent
086c27c043
commit
58b17a8807
|
@ -182,8 +182,8 @@ float LECalculator::getValue(Engine *engine) {
|
||||||
return stack.pop();
|
return stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
LEElementPool::LEElementPool(int size) {
|
LEElementPool::LEElementPool(LEElement *pool, int size) {
|
||||||
pool = thepool;
|
this->pool = pool;
|
||||||
this->size = size;
|
this->size = size;
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ void LEElementPool::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LEElement *LEElementPool::next() {
|
LEElement *LEElementPool::next() {
|
||||||
if (index == LE_ELEMENT_POOL_SIZE - 1) {
|
if (index == size - 1) {
|
||||||
firmwareError("LE_ELEMENT_POOL_SIZE overflow");
|
firmwareError("LE_ELEMENT_POOL_SIZE overflow");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,12 +53,9 @@ public:
|
||||||
LEElement *next;
|
LEElement *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LE_ELEMENT_POOL_SIZE 256
|
|
||||||
|
|
||||||
class LEElementPool {
|
class LEElementPool {
|
||||||
public:
|
public:
|
||||||
LEElementPool(int size);
|
LEElementPool(LEElement *pool, int size);
|
||||||
LEElement thepool[LE_ELEMENT_POOL_SIZE];
|
|
||||||
LEElement *pool;
|
LEElement *pool;
|
||||||
LEElement *next();
|
LEElement *next();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
|
@ -57,7 +57,11 @@
|
||||||
|
|
||||||
LECalculator calc;
|
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 * fuelPumpLogic;
|
||||||
LEElement * radiatorFanLogic;
|
LEElement * radiatorFanLogic;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "cli_registry.h"
|
#include "cli_registry.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
|
#define TEST_POOL_SIZE 256
|
||||||
|
|
||||||
static float mockCoolant;
|
static float mockCoolant;
|
||||||
static float mockFan;
|
static float mockFan;
|
||||||
static float mockRpm;
|
static float mockRpm;
|
||||||
|
@ -56,7 +58,8 @@ static void testParsing(void) {
|
||||||
assertTrue(isNumeric("123"));
|
assertTrue(isNumeric("123"));
|
||||||
assertFalse(isNumeric("a123"));
|
assertFalse(isNumeric("a123"));
|
||||||
|
|
||||||
LEElementPool pool(LE_ELEMENT_POOL_SIZE);
|
LEElement thepool[TEST_POOL_SIZE];
|
||||||
|
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
||||||
|
|
||||||
LEElement *element;
|
LEElement *element;
|
||||||
element = parseExpression(&pool, "1 3 AND not");
|
element = parseExpression(&pool, "1 3 AND not");
|
||||||
|
@ -80,7 +83,8 @@ static void testParsing(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void testExpression(const char *line, float expected) {
|
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();
|
pool.reset();
|
||||||
LEElement * element = parseExpression(&pool, line);
|
LEElement * element = parseExpression(&pool, line);
|
||||||
print("Parsing [%s]", line);
|
print("Parsing [%s]", line);
|
||||||
|
@ -119,7 +123,8 @@ void testLogicExpressions(void) {
|
||||||
|
|
||||||
c.reset();
|
c.reset();
|
||||||
|
|
||||||
LEElementPool pool(LE_ELEMENT_POOL_SIZE);
|
LEElement thepool[TEST_POOL_SIZE];
|
||||||
|
LEElementPool pool(thepool, TEST_POOL_SIZE);
|
||||||
LEElement *e = pool.next();
|
LEElement *e = pool.next();
|
||||||
e->init(LE_METHOD_TIME_SINCE_BOOT);
|
e->init(LE_METHOD_TIME_SINCE_BOOT);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue