auto-sync
This commit is contained in:
parent
52097024eb
commit
f31c58bdf1
|
@ -40,6 +40,7 @@ static LENameOrdinalPair leLessOrEquals(LE_OPERATOR_LESS_OR_EQUAL, "<=");
|
|||
|
||||
static LENameOrdinalPair leMax(LE_METHOD_MAX, "max");
|
||||
static LENameOrdinalPair leMin(LE_METHOD_MIN, "min");
|
||||
static LENameOrdinalPair leIf(LE_METHOD_IF, "if");
|
||||
|
||||
#define LE_EVAL_POOL_SIZE 32
|
||||
|
||||
|
@ -205,6 +206,14 @@ void LECalculator::doJob(Engine *engine, LEElement *element) {
|
|||
stack.push(v1 >= v2);
|
||||
}
|
||||
break;
|
||||
case LE_METHOD_IF: {
|
||||
// elements on stack are in reverse order
|
||||
float vFalse = pop(LE_METHOD_IF);
|
||||
float vTrue = pop(LE_METHOD_IF);
|
||||
float vCond = pop(LE_METHOD_IF);
|
||||
stack.push(vCond != 0 ? vTrue : vFalse);
|
||||
}
|
||||
break;
|
||||
case LE_METHOD_MAX: {
|
||||
float v2 = pop(LE_METHOD_MAX);
|
||||
float v1 = pop(LE_METHOD_MAX);
|
||||
|
|
|
@ -29,6 +29,7 @@ typedef enum {
|
|||
LE_OPERATOR_DIVISION = 12,
|
||||
LE_METHOD_MAX = 13,
|
||||
LE_METHOD_MIN = 14,
|
||||
LE_METHOD_IF = 15,
|
||||
|
||||
LE_METHOD_RPM = 100,
|
||||
LE_METHOD_COOLANT = 101,
|
||||
|
|
|
@ -167,10 +167,9 @@ void testLogicExpressions(void) {
|
|||
testExpression("coolant 90 >", 1);
|
||||
testExpression("fan not coolant 90 > and", 1);
|
||||
|
||||
|
||||
testExpression("100 200 1 if", 200);
|
||||
testExpression("10 99 max", 99);
|
||||
|
||||
|
||||
testExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR", 1);
|
||||
|
||||
mockRpm = 900;
|
||||
|
|
Loading…
Reference in New Issue