auto-sync
This commit is contained in:
parent
60d04b422e
commit
4f77977e11
|
@ -19,6 +19,7 @@ static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
|
||||||
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
|
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
|
||||||
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting");
|
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting");
|
||||||
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting");
|
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting");
|
||||||
|
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot");
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
|
|
|
@ -56,6 +56,24 @@ void LECalculator::reset() {
|
||||||
stack.reset();
|
stack.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LECalculator::reset(LEElement *element) {
|
||||||
|
first = NULL;
|
||||||
|
stack.reset();
|
||||||
|
add(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LECalculator::add(LEElement *element) {
|
||||||
|
if (first == NULL) {
|
||||||
|
first = element;
|
||||||
|
} else {
|
||||||
|
LEElement *last = first;
|
||||||
|
while (last->next != NULL) {
|
||||||
|
last = last->next;
|
||||||
|
}
|
||||||
|
last->next = element;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool float2bool(float v) {
|
static bool float2bool(float v) {
|
||||||
return v != 0;
|
return v != 0;
|
||||||
}
|
}
|
||||||
|
@ -138,18 +156,6 @@ float LECalculator::getValue() {
|
||||||
return stack.pop();
|
return stack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LECalculator::add(LEElement *element) {
|
|
||||||
if (first == NULL) {
|
|
||||||
first = element;
|
|
||||||
} else {
|
|
||||||
LEElement *last = first;
|
|
||||||
while (last->next != NULL) {
|
|
||||||
last = last->next;
|
|
||||||
}
|
|
||||||
last->next = element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LEElementPool::LEElementPool() {
|
LEElementPool::LEElementPool() {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
@ -159,6 +165,10 @@ void LEElementPool::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
LEElement *LEElementPool::next() {
|
LEElement *LEElementPool::next() {
|
||||||
|
if (index == LE_ELEMENT_POOL_SIZE - 1) {
|
||||||
|
firmwareError("LE_ELEMENT_POOL_SIZE overflow");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return &pool[index++];
|
return &pool[index++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
LEElement *next;
|
LEElement *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LE_ELEMENT_POOL_SIZE 64
|
#define LE_ELEMENT_POOL_SIZE 256
|
||||||
|
|
||||||
class LEElementPool {
|
class LEElementPool {
|
||||||
public:
|
public:
|
||||||
|
@ -73,6 +73,7 @@ public:
|
||||||
float getValue();
|
float getValue();
|
||||||
void add(LEElement *element);
|
void add(LEElement *element);
|
||||||
void reset();
|
void reset();
|
||||||
|
void reset(LEElement *element);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void doJob(LEElement *element);
|
void doJob(LEElement *element);
|
||||||
|
|
|
@ -52,6 +52,15 @@
|
||||||
#include "ec2.h"
|
#include "ec2.h"
|
||||||
#include "PwmTester.h"
|
#include "PwmTester.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
#include "logic_expression.h"
|
||||||
|
|
||||||
|
#define FUEL_PUMP_LOGIC "time_since_boot 4 less rpm 0 > OR"
|
||||||
|
|
||||||
|
LECalculator calc;
|
||||||
|
|
||||||
|
LEElementPool lePool;
|
||||||
|
LEElement * fuelPumpLogic;
|
||||||
|
LEElement * radiatorFanLogic;
|
||||||
|
|
||||||
extern board_configuration_s *boardConfiguration;
|
extern board_configuration_s *boardConfiguration;
|
||||||
|
|
||||||
|
@ -337,5 +346,7 @@ void initEngineContoller(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
fuelPumpLogic = parseExpression(&lePool, FUEL_PUMP_LOGIC);
|
||||||
|
|
||||||
addConsoleAction("analoginfo", printAnalogInfo);
|
addConsoleAction("analoginfo", printAnalogInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ void testLogicExpressions(void) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fuel_pump = (time_since_boot < 4 seconds) OR (rpm > 0)
|
* fuel_pump = (time_since_boot < 4 seconds) OR (rpm > 0)
|
||||||
* fuel_pump = time_since_boot 4 less rpm 0 more OR
|
* fuel_pump = time_since_boot 4 less rpm 0 > OR
|
||||||
*/
|
*/
|
||||||
|
|
||||||
c.reset();
|
c.reset();
|
||||||
|
|
Loading…
Reference in New Issue