auto-sync
This commit is contained in:
parent
b51f7d6d32
commit
784db85f38
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue