Remove FSIO, byeeeeeeeee (#3865)

* vestigial config

* replace last functionality

* engine/board configs include

* files that didn't need to include this

* remove FSIO implementation

* stragglers

* random little bits

* s

* s

* ConfigDefinition

* jar

* s
This commit is contained in:
Matthew Kennedy 2022-02-01 23:03:31 -08:00 committed by GitHub
parent 924f175151
commit 10be2d5f40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 14 additions and 864 deletions

View File

@ -30,6 +30,7 @@ All notable user-facing or behavior-altering changes will be documented in this
## Removed
- Miata NB1 trigger was merged with Miata NB2 trigger
- FSIO
## January 2022 Release - "Green Juice"

View File

@ -13,8 +13,6 @@
#define EFI_GPIO_HARDWARE TRUE
#define EFI_FSIO TRUE
#define EFI_CDM_INTEGRATION FALSE
#define EFI_TOOTH_LOGGER FALSE

View File

@ -12,8 +12,6 @@
#define EFI_GPIO_HARDWARE TRUE
#define EFI_FSIO FALSE
#define EFI_CDM_INTEGRATION FALSE
#define EFI_TOOTH_LOGGER FALSE

View File

@ -19,9 +19,6 @@
#define EFI_INTERNAL_ADC TRUE
#define EFI_ANALOG_SENSORS TRUE
// Console I/O features to monitor formulas and pin state
#define EFI_FSIO TRUE
// Log crank/cam sensor events, a frequently needed diag for new installations
#define EFI_TOOTH_LOGGER TRUE

View File

@ -17,8 +17,6 @@
#define EFI_DYNO_VIEW TRUE
#define EFI_FSIO TRUE
#ifndef EFI_CDM_INTEGRATION
#define EFI_CDM_INTEGRATION FALSE
#endif

View File

@ -1679,14 +1679,14 @@ typedef enum {
CUSTOM_NAN_ENGINE_LOAD_2 = 6002,
CUSTOM_OBD_6003 = 6003,
CUSTOM_OBD_6004 = 6004,
CUSTOM_EMPTY_FSIO_STACK = 6005,
CUSTOM_UNKNOWN_FSIO = 6006,
CUSTOM_NO_FSIO = 6007,
CUSTOM_FSIO_STACK_SIZE = 6008,
CUSTOM_FSIO_UNEXPECTED = 6009,
CUSTOM_6005 = 6005,
CUSTOM_6006 = 6006,
CUSTOM_6007 = 6007,
CUSTOM_6008 = 6008,
CUSTOM_6009 = 6009,
CUSTOM_FSIO_PARSING = 6010,
CUSTOM_FSIO_INVALID_EXPRESSION = 6011,
CUSTOM_6010 = 6010,
CUSTOM_6011 = 6011,
CUSTOM_INTEPOLATE_ERROR = 6012,
CUSTOM_INTEPOLATE_ERROR_2 = 6013,
CUSTOM_INTEPOLATE_ERROR_3 = 6014,
@ -1841,7 +1841,7 @@ typedef enum {
CUSTOM_ERR_ASSERT = 6500,
CUSTOM_ERR_ASSERT_VOID = 6501,
ERROR_FL_STACK_OVERFLOW = 6502,
CUSTOM_ERR_FSIO_POOL = 6503,
CUSTOM_6503 = 6503,
CUSTOM_FLSTACK = 6504,
CUSTOM_ERR_NAN_TCHARGE = 6505,
CUSTOM_EGO_TYPE = 6506,

View File

@ -1,6 +1,5 @@
CONTROLLERS_CORE_SRC_CPP = \
$(PROJECT_DIR)/controllers/core/state_sequence.cpp \
$(PROJECT_DIR)/controllers/core/fsio_core.cpp \
$(PROJECT_DIR)/controllers/core/fsio_impl.cpp \

View File

@ -1,408 +0,0 @@
/**
* @file fsio_core.cpp
* @brief core FSUI handling logic
*
* Here we parse and evaluate logical expressions in
* http://en.wikipedia.org/wiki/Reverse_Polish_notation
*
* Once the expressions are parsed on startup (that's a heavy operation),
* evaluating those is relatively efficient.
*
*
* @date Oct 3, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "pch.h"
#if EFI_FSIO
#include "os_access.h"
#include "fsio_core.h"
#include "fsio_impl.h"
LENameOrdinalPair * LE_FIRST = nullptr;
/**
* the main point of these static fields is that their constructor would register
* them in the magic list of operator name/ordinal pairs
*/
static LENameOrdinalPair leAnd(LE_OPERATOR_AND, "and");
static LENameOrdinalPair leAnd2(LE_OPERATOR_AND, "&");
static LENameOrdinalPair leOr(LE_OPERATOR_OR, "or");
static LENameOrdinalPair leOr2(LE_OPERATOR_OR, "|");
static LENameOrdinalPair leNot(LE_OPERATOR_NOT, "not");
static LENameOrdinalPair leNot2(LE_OPERATOR_NOT, "!");
static LENameOrdinalPair leAdd(LE_OPERATOR_ADDITION, "+");
static LENameOrdinalPair leSub(LE_OPERATOR_SUBTRACTION, "-");
static LENameOrdinalPair leMul(LE_OPERATOR_MULTIPLICATION, "*");
static LENameOrdinalPair leDiv(LE_OPERATOR_DIVISION, "/");
static LENameOrdinalPair leMore(LE_OPERATOR_MORE, ">");
static LENameOrdinalPair leMoreOrEqual(LE_OPERATOR_MORE_OR_EQUAL, ">=");
static LENameOrdinalPair leLess(LE_OPERATOR_LESS, "<");
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");
static LENameOrdinalPair leSelf(LE_METHOD_SELF, "self");
LENameOrdinalPair::LENameOrdinalPair(le_action_e action, const char *name) {
this->action = action;
this->name = name;
this->next = LE_FIRST;
LE_FIRST = this;
}
LEElement::LEElement() {
clear();
}
void LEElement::clear() {
action = LE_UNDEFINED;
fValue = NAN;
}
void LEElement::init(le_action_e action) {
this->action = action;
}
void LEElement::init(le_action_e action, float fValue) {
this->action = action;
this->fValue = fValue;
}
void LEElement::init(le_action_e action, bool bValue) {
this->action = action;
this->fValue = bValue ? 1 : 0;
}
LECalculator::LECalculator() {
reset();
}
void LECalculator::reset() {
stack.reset();
currentCalculationLogPosition = 0;
memset(calcLogAction, 0, sizeof(calcLogAction));
}
bool float2bool(float v) {
return v != 0;
}
float LECalculator::pop(le_action_e action) {
if (stack.size() == 0) {
warning(CUSTOM_EMPTY_FSIO_STACK, "empty stack for action=%d", action);
return NAN;
}
return stack.pop();
}
void LECalculator::push(le_action_e action, float value) {
stack.push(value);
if (currentCalculationLogPosition < MAX_CALC_LOG) {
calcLogAction[currentCalculationLogPosition] = action;
calcLogValue[currentCalculationLogPosition] = value;
currentCalculationLogPosition++;
}
}
static FsioResult doBinaryBoolean(le_action_e action, float lhs, float rhs) {
bool v1 = float2bool(lhs);
bool v2 = float2bool(rhs);
switch (action) {
case LE_OPERATOR_AND:
return v1 && v2;
case LE_OPERATOR_OR:
return v1 || v2;
default:
return unexpected;
}
}
static FsioResult doBinaryNumeric(le_action_e action, float v1, float v2) {
// Process based on the action type
switch (action) {
case LE_OPERATOR_ADDITION:
return v1 + v2;
case LE_OPERATOR_SUBTRACTION:
return v1 - v2;
case LE_OPERATOR_MULTIPLICATION:
return v1 * v2;
case LE_OPERATOR_DIVISION:
return v1 / v2;
case LE_OPERATOR_LESS:
return v1 < v2;
case LE_OPERATOR_MORE:
return v1 > v2;
case LE_OPERATOR_LESS_OR_EQUAL:
return v1 <= v2;
case LE_OPERATOR_MORE_OR_EQUAL:
return v1 >= v2;
case LE_METHOD_MIN:
return minF(v1, v2);
case LE_METHOD_MAX:
return maxF(v1, v2);
default:
return unexpected;
}
}
/**
* @return true in case of error, false otherwise
*/
FsioResult LECalculator::processElement(const LEElement *element) {
#if EFI_PROD_CODE
efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 64, "FSIO logic", unexpected);
#endif
switch (element->action) {
// Literal values
case LE_NUMERIC_VALUE:
return element->fValue;
case LE_BOOLEAN_VALUE:
return element->fValue != 0;
// Boolean input binary operators
case LE_OPERATOR_AND:
case LE_OPERATOR_OR: {
float v1 = pop(LE_OPERATOR_OR);
float v2 = pop(LE_OPERATOR_OR);
return doBinaryBoolean(element->action, v1, v2);
}
// Numeric input binary operators
case LE_OPERATOR_ADDITION:
case LE_OPERATOR_SUBTRACTION:
case LE_OPERATOR_MULTIPLICATION:
case LE_OPERATOR_DIVISION:
case LE_OPERATOR_LESS:
case LE_OPERATOR_MORE:
case LE_OPERATOR_LESS_OR_EQUAL:
case LE_OPERATOR_MORE_OR_EQUAL:
case LE_METHOD_MIN:
case LE_METHOD_MAX: {
// elements on stack are in reverse order
float v2 = pop(element->action);
float v1 = pop(element->action);
return doBinaryNumeric(element->action, v1, v2);
}
// Boolean input unary operator
case LE_OPERATOR_NOT: {
float v = pop(LE_OPERATOR_NOT);
return !float2bool(v) ? 1 : 0;
}
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);
return vCond != 0 ? vTrue : vFalse;
}
case LE_METHOD_FSIO_SETTING: {
return unexpected;
}
case LE_METHOD_SCRIPT_TABLE: {
return unexpected;
}
case LE_METHOD_FSIO_DIGITAL_INPUT:
// todo: implement code for digital input!!!
return unexpected;
case LE_METHOD_FSIO_ANALOG_INPUT:
{
int index = clampF(0, pop(LE_METHOD_FSIO_ANALOG_INPUT), AUX_ANALOG_INPUT_COUNT - 1);
int sensorIdx = static_cast<int>(SensorType::Aux1) + index;
return Sensor::get(static_cast<SensorType>(sensorIdx));
}
default:
case LE_UNDEFINED:
warning(CUSTOM_UNKNOWN_FSIO, "FSIO undefined action");
return unexpected;
}
}
float LECalculator::evaluate(const char * msg, float selfValue, const LEElement* element) {
if (!element) {
warning(CUSTOM_NO_FSIO, "%s no FSIO code", msg);
return NAN;
}
reset();
int counter = 0;
// while not a return statement, execute instructions
while (element->action != LE_METHOD_RETURN) {
efiAssert(CUSTOM_ERR_ASSERT, counter < 200, "FSIOcount", NAN); // just in case
if (element->action == LE_METHOD_SELF) {
push(element->action, selfValue);
} else {
FsioResult result = processElement(element);
if (!result) {
// error already reported
return NAN;
}
push(element->action, result.Value);
}
// Step forward to the next instruction in sequence
element++;
counter++;
}
// The stack should have exactly one element on it
if (stack.size() != 1) {
warning(CUSTOM_FSIO_STACK_SIZE, "%s unexpected FSIO stack size at return: %d", msg, stack.size());
return NAN;
}
return stack.pop();
}
LEElementPool::LEElementPool(LEElement *pool, int size) {
this->m_pool = pool;
this->size = size;
reset();
}
void LEElementPool::reset() {
// Next free element is the first one
m_nextFree = m_pool;
}
int LEElementPool::getSize() const {
return m_nextFree - m_pool;
}
bool isNumeric(const char* line) {
return line[0] >= '0' && line[0] <= '9';
}
bool isBoolean(const char* line) {
bool isTrue = 0 == strcmp(line, "true");
bool isFalse = 0 == strcmp(line, "false");
return isTrue || isFalse;
}
/**
* @return pointer at the position after the consumed token, null if no token consumed
*/
const char *getNextToken(const char *line, char *buffer, const int bufferSize) {
while (line[0] != 0 && line[0] == ' ') {
line++;
}
if (line[0] == 0) {
return NULL;
}
int tokenLen = indexOf(line, ' ');
if (tokenLen == -1) {
// no space - the whole remaining line is the token
tokenLen = strlen(line);
}
efiAssert(CUSTOM_ERR_ASSERT, tokenLen < bufferSize, "token overflow", NULL);
strncpy(buffer, line, tokenLen);
buffer[tokenLen] = 0;
line += tokenLen;
return line;
}
le_action_e parseAction(const char * line) {
LENameOrdinalPair *pair = LE_FIRST;
while (pair != NULL) {
if (strEqualCaseInsensitive(pair->name, line)) {
return pair->action;
}
pair = pair->next;
}
return LE_UNDEFINED;
}
static char parsingBuffer[64];
LEElement* LEElementPool::parseExpression(const char * line) {
LEElement* expressionHead = m_nextFree;
LEElement* n = expressionHead;
while (true) {
line = getNextToken(line, parsingBuffer, sizeof(parsingBuffer));
if (!line) {
/**
* No more tokens in this line, parsing complete!
*/
// Push a return statement on the end
n->init(LE_METHOD_RETURN);
// The next available element is the one after the return
m_nextFree = n + 1;
return expressionHead;
}
if (isNumeric(parsingBuffer)) {
n->init(LE_NUMERIC_VALUE, atoff(parsingBuffer));
} else if (isBoolean(parsingBuffer)) {
n->init(LE_BOOLEAN_VALUE, parsingBuffer[0] == 't');
} else {
le_action_e action = parseAction(parsingBuffer);
if (action == LE_UNDEFINED) {
/**
* Cannot recognize token
*/
firmwareError(CUSTOM_ERR_PARSING_ERROR, "unrecognized FSIO keyword [%s]", parsingBuffer);
return nullptr;
}
n->init(action);
}
n++;
}
}
FsioValue::FsioValue(float f)
{
u.f32 = f;
// The low bit represents whether this is a bool or not, clear it for float
u.u32 &= 0xFFFFFFFE;
}
FsioValue::FsioValue(bool b)
{
u.u32 = (b ? 2 : 0); // second bit is the actual value of the bool
// Low bit indicates this is a bool
u.u32 |= 0x1;
}
bool FsioValue::isFloat() const {
uint32_t typeBit = u.u32 & 0x1;
return typeBit == 0;
}
float FsioValue::asFloat() const {
return u.f32;
}
bool FsioValue::isBool() const {
uint32_t typeBit = u.u32 & 0x1;
return typeBit == 1;
}
bool FsioValue::asBool() const {
uint32_t boolBit = u.u32 & 0x2;
return boolBit != 0;
}
#endif /* EFI_FSIO */

View File

@ -1,156 +0,0 @@
/**
* @file fsio_core.h
*
* @date Oct 3, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#pragma once
#define MAX_TABLE_INDEX 4
typedef enum {
LE_UNDEFINED = 0,
LE_METHOD_RETURN = 130,
LE_NUMERIC_VALUE = 1,
LE_BOOLEAN_VALUE = 126,
LE_OPERATOR_LESS = 2,
LE_OPERATOR_MORE = 3,
LE_OPERATOR_LESS_OR_EQUAL = 4,
LE_OPERATOR_MORE_OR_EQUAL = 5,
LE_OPERATOR_AND = 6,
LE_OPERATOR_OR = 7,
LE_OPERATOR_NOT = 8,
LE_OPERATOR_ADDITION = 9,
LE_OPERATOR_SUBTRACTION = 10,
LE_OPERATOR_MULTIPLICATION = 11,
LE_OPERATOR_DIVISION = 12,
LE_METHOD_MAX = 13,
LE_METHOD_MIN = 14,
LE_METHOD_IF = 15,
LE_METHOD_RPM = 100,
LE_METHOD_COOLANT = 101,
LE_METHOD_FAN = 102,
LE_METHOD_TPS = 106,
LE_METHOD_MAF = 107,
LE_METHOD_INTAKE_AIR = 108,
LE_METHOD_VBATT = 109,
LE_METHOD_AC_TOGGLE = 110,
LE_METHOD_TIME_SINCE_AC_TOGGLE = 111,
LE_METHOD_SCRIPT_TABLE = 113,
LE_METHOD_SELF = 114,
LE_METHOD_MAP = 115,
LE_METHOD_FSIO_ANALOG_INPUT = 116,
LE_METHOD_INTAKE_VVT = 117,
LE_METHOD_EXHAUST_VVT = 118,
LE_METHOD_IS_COOLANT_BROKEN = 119,
LE_METHOD_CRANKING_RPM = 120,
LE_METHOD_FSIO_DIGITAL_INPUT = 123,
LE_METHOD_FSIO_SETTING = 124,
LE_METHOD_PPS = 125,
LE_METHOD_FUEL_FLOW_RATE = 131,
LE_METHOD_OIL_PRESSURE = 132,
Force_4b_le_action = ENUM_32_BITS,
} le_action_e;
// This type borrows the least significant bit of a float and uses it to indicate
// whether it's actually a boolean hiding inside that float
class FsioValue
{
public:
/*implicit*/ FsioValue(float f);
/*implicit*/ FsioValue(bool b);
bool isFloat() const;
float asFloat() const;
bool isBool() const;
bool asBool() const;
private:
// These must match for this trick to work!
static_assert(sizeof(float) == sizeof(uint32_t));
union
{
uint32_t u32;
float f32;
} u;
};
using FsioResult = expected<float>;
class LEElement {
public:
LEElement();
void clear();
void init(le_action_e action);
void init(le_action_e action, float value);
void init(le_action_e action, bool value);
le_action_e action;
float fValue;
};
class LEElementPool {
public:
LEElementPool(LEElement *pool, int size);
void reset();
LEElement * parseExpression(const char * line);
int getSize() const;
private:
LEElement* m_pool;
LEElement* m_nextFree;
int size;
};
#define MAX_STACK_DEPTH 32
typedef FLStack<float, MAX_STACK_DEPTH> calc_stack_t;
#define MAX_CALC_LOG 64
class LECalculator {
public:
LECalculator();
float evaluate(const char * msg, float selfValue, const LEElement* element);
void reset();
// Log history of calculation actions for debugging
le_action_e calcLogAction[MAX_CALC_LOG];
float calcLogValue[MAX_CALC_LOG];
int currentCalculationLogPosition;
private:
void push(le_action_e action, float value);
FsioResult processElement(const LEElement* element);
float pop(le_action_e action);
calc_stack_t stack;
};
class LENameOrdinalPair {
public:
LENameOrdinalPair(le_action_e action, const char *name);
LENameOrdinalPair *next;
le_action_e action;
const char *name;
};
/**
* This method extract the first token on the line into the specified buffer
*
* @return pointer after the token
*/
const char *getNextToken(const char *line, char *buffer, const int bufferSize);
bool isNumeric(const char* line);
le_action_e parseAction(const char * line);
bool float2bool(float v);

View File

@ -2,10 +2,7 @@
* @file fsio_impl.cpp
* @brief FSIO as it's used for GPIO
*
* set debug_mode 23
* https://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
*
* 'fsioinfo' command in console shows current state of FSIO - formulas and current value
* TODO: rename this file, FSIO is gone!
*
* @date Oct 5, 2014
* @author Andrey Belomutskiy, (c) 2012-2020
@ -15,152 +12,11 @@
#include "fsio_impl.h"
#if EFI_PROD_CODE
// todo: that's about bench test mode, wrong header for sure!
#include "bench_test.h"
#endif // EFI_PROD_CODE
#if EFI_FSIO
#include "os_access.h"
/**
* in case of zero frequency pin is operating as simple on/off. '1' for ON and '0' for OFF
*
*/
#define NO_PWM 0
static fsio8_Map3D_f32t scriptTable1;
static fsio8_Map3D_u8t scriptTable2;
static fsio8_Map3D_u8t scriptTable3;
static fsio8_Map3D_u8t scriptTable4;
/**
* Here we define all rusEfi-specific methods
*/
static LENameOrdinalPair leRpm(LE_METHOD_RPM, "rpm");
static LENameOrdinalPair leTps(LE_METHOD_TPS, "tps");
static LENameOrdinalPair lePps(LE_METHOD_PPS, "pps");
static LENameOrdinalPair leMaf(LE_METHOD_MAF, "maf");
static LENameOrdinalPair leMap(LE_METHOD_MAP, "map");
static LENameOrdinalPair leVBatt(LE_METHOD_VBATT, "vbatt");
static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
static LENameOrdinalPair leIntakeTemp(LE_METHOD_INTAKE_AIR, "iat");
static LENameOrdinalPair leIsCoolantBroken(LE_METHOD_IS_COOLANT_BROKEN, "is_clt_broken");
static LENameOrdinalPair leOilPressure(LE_METHOD_OIL_PRESSURE, "oilp");
// @returns boolean state of A/C toggle switch
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
// @returns float number of seconds since last A/C toggle
static LENameOrdinalPair leTimeSinceAcToggle(LE_METHOD_TIME_SINCE_AC_TOGGLE, "time_since_ac_on_switch");
static LENameOrdinalPair leFsioSetting(LE_METHOD_FSIO_SETTING, FSIO_METHOD_FSIO_SETTING);
static LENameOrdinalPair leFsioAnalogInput(LE_METHOD_FSIO_ANALOG_INPUT, FSIO_METHOD_FSIO_ANALOG_INPUT);
static LENameOrdinalPair leFsioDigitalInput(LE_METHOD_FSIO_DIGITAL_INPUT, FSIO_METHOD_FSIO_DIGITAL_INPUT);
static LENameOrdinalPair leIntakeVVT(LE_METHOD_INTAKE_VVT, "ivvt");
static LENameOrdinalPair leExhaustVVT(LE_METHOD_EXHAUST_VVT, "evvt");
static LENameOrdinalPair leCrankingRpm(LE_METHOD_CRANKING_RPM, "cranking_rpm");
static LENameOrdinalPair leFuelRate(LE_METHOD_FUEL_FLOW_RATE, "fuel_flow");
#define SYS_ELEMENT_POOL_SIZE 24
#define UD_ELEMENT_POOL_SIZE 64
static LEElement sysElements[SYS_ELEMENT_POOL_SIZE];
CCM_OPTIONAL LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE);
#if EFI_PROD_CODE || EFI_SIMULATOR
FsioResult getEngineValue(le_action_e action) {
switch (action) {
case LE_METHOD_FAN:
return enginePins.fanRelay.getLogicValue();
case LE_METHOD_TIME_SINCE_AC_TOGGLE:
return (getTimeNowUs() - engine->acSwitchLastChangeTime) / US_PER_SECOND_F;
case LE_METHOD_AC_TOGGLE:
return getAcToggle();
case LE_METHOD_COOLANT:
return Sensor::getOrZero(SensorType::Clt);
case LE_METHOD_IS_COOLANT_BROKEN:
return !Sensor::get(SensorType::Clt).Valid;
case LE_METHOD_INTAKE_AIR:
return Sensor::getOrZero(SensorType::Iat);
case LE_METHOD_RPM:
return Sensor::getOrZero(SensorType::Rpm);
case LE_METHOD_MAF:
return Sensor::getOrZero(SensorType::Maf);
case LE_METHOD_MAP:
return Sensor::getOrZero(SensorType::Map);
#if EFI_SHAFT_POSITION_INPUT
case LE_METHOD_INTAKE_VVT:
return engine->triggerCentral.getVVTPosition(0, 0);
case LE_METHOD_EXHAUST_VVT:
return engine->triggerCentral.getVVTPosition(0, 1);
#endif
case LE_METHOD_CRANKING_RPM:
return engineConfiguration->cranking.rpm;
case LE_METHOD_VBATT:
return Sensor::getOrZero(SensorType::BatteryVoltage);
case LE_METHOD_TPS:
return Sensor::getOrZero(SensorType::DriverThrottleIntent);
case LE_METHOD_FUEL_FLOW_RATE:
return engine->engineState.fuelConsumption.getConsumptionGramPerSecond();
case LE_METHOD_OIL_PRESSURE:
return Sensor::getOrZero(SensorType::OilPressure);
// cfg_xxx references are code generated
default:
warning(CUSTOM_FSIO_UNEXPECTED, "FSIO ERROR no data for action=%d", action);
return unexpected;
}
}
#endif
static LECalculator calc CCM_OPTIONAL;
static const char * action2String(le_action_e action) {
static char buffer[_MAX_FILLER];
switch(action) {
case LE_METHOD_RPM:
return "RPM";
case LE_METHOD_CRANKING_RPM:
return "cranking_rpm";
case LE_METHOD_COOLANT:
return "CLT";
case LE_METHOD_FAN:
return "fan";
default: {
// this is here to make compiler happy
}
}
itoa10(buffer, (int)action);
return buffer;
}
static void setPinState(const char * msg, OutputPin *pin, LEElement *element) {
#if EFI_PROD_CODE
if (isRunningBenchTest()) {
return; // let's not mess with bench testing
}
#endif /* EFI_PROD_CODE */
if (!element) {
warning(CUSTOM_FSIO_INVALID_EXPRESSION, "invalid expression for %s", msg);
} else {
int value = (int)calc.evaluate(msg, pin->getLogicValue(), element);
if (pin->isInitialized() && value != pin->getLogicValue()) {
for (int i = 0;i < calc.currentCalculationLogPosition;i++) {
efiPrintf("calc %d: action %s value %.2f", i, action2String(calc.calcLogAction[i]), calc.calcLogValue[i]);
}
efiPrintf("setPin %s %s", msg, value ? "on" : "off");
pin->setValue(value);
}
}
}
ValueProvider3D *getscriptTable(int index) {
switch (index) {
default:
@ -223,6 +79,7 @@ float getCurveValue(int index, float key) {
}
}
// TODO: rename
void initFsioImpl() {
scriptTable1.init(config->scriptTable1, config->scriptTable1LoadBins,
config->scriptTable1RpmBins);
@ -232,7 +89,4 @@ void initFsioImpl() {
config->scriptTable3RpmBins);
scriptTable4.init(config->scriptTable4, config->scriptTable4LoadBins,
config->scriptTable4RpmBins);
}
#endif /* EFI_FSIO */

View File

@ -8,14 +8,7 @@
#pragma once
#include "fsio_core.h"
#include "expected.h"
#include "system_fsio.h"
// see useFSIO4ForSeriousEngineWarning
#define MAGIC_OFFSET_FOR_ENGINE_WARNING 4
// see useFSIO5ForCriticalIssueEngineStop
#define MAGIC_OFFSET_FOR_CRITICAL_ENGINE 5
typedef Map3D<SCRIPT_TABLE_8, SCRIPT_TABLE_8, float, uint16_t, uint16_t> fsio8_Map3D_f32t;
typedef Map3D<SCRIPT_TABLE_8, SCRIPT_TABLE_8, uint8_t, uint16_t, uint16_t> fsio8_Map3D_u8t;
@ -27,4 +20,3 @@ int getCurveIndexByName(const char *name);
int getTableIndexByName(const char *name);
int getSettingIndexByName(const char *name);
ValueProvider3D *getscriptTable(int index);

View File

@ -25,7 +25,6 @@
#include "os_access.h"
#include "trigger_central.h"
#include "fsio_core.h"
#include "fsio_impl.h"
#include "idle_thread.h"
#include "advance_map.h"
@ -505,9 +504,8 @@ void commonInitEngineController() {
initAccelEnrichment();
#if EFI_FSIO
// TODO: rename
initFsioImpl();
#endif /* EFI_FSIO */
initGpPwm();

View File

@ -1,65 +0,0 @@
// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically
// from controllers/system_fsio.txt
// on 2021-03-20_12_45_43_719
//
//
// in this file we define system FSIO expressions
//
// system_fsio.txt is input for compile_fsio_file tool, see gen_system_fsio.bat
//
// see http://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
//
// Jan 19, 2017
// Andrey Belomutskiy, (c) 2012-2017
//
// different way to have the same result would be using "self"
// (self and (coolant > fan_off_setting)) | (coolant > fan_on_setting) | is_clt_broken
// Human-readable: coolant > 120
#define TOO_HOT_LOGIC "coolant 120 >"
// Combined RPM, CLT and VBATT warning light
// Human-readable: (rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
#define COMBINED_WARNING_LIGHT "rpm 2 fsio_setting > coolant 3 fsio_setting > vbatt 4 fsio_setting < | |"
// Human-readable: rpm > fsio_setting(1)
#define RPM_ABOVE_USER_SETTING_1 "rpm 1 fsio_setting >"
// Human-readable: rpm < fsio_setting(3)
#define RPM_BELOW_USER_SETTING_3 "rpm 3 fsio_setting <"
// could be used for simple variable intake geometry setups or warning light or starter block
// Human-readable: rpm > fsio_setting(1)
#define RPM_ABOVE_USER_SETTING_1 "rpm 1 fsio_setting >"
// Human-readable: rpm > fsio_setting(2)
#define RPM_ABOVE_USER_SETTING_2 "rpm 2 fsio_setting >"
// Human-readable: rpm > 5500
#define RPM_ABOVE_5500_ON_OFF "rpm 5500 >"
// Human-readable: rpm > 6000
#define RPM_ABOVE_6000_ON_OFF "rpm 6000 >"
// Human-readable: (rpm > 1000) * 0.7
#define RPM_ABOVE_1000_SOLENOID_70_DUTY "rpm 1000 > 0.7 *"
// Human-readable: (rpm > 2000) * 0.5
#define RPM_ABOVE_2000_SOLENOID_50_DUTY "rpm 2000 > 0.5 *"
// Human-readable: (rpm > 6000) * 0.8
#define RPM_ABOVE_6000_SOLENOID_80_DUTY "rpm 6000 > 0.8 *"
// Human-readable: rpm < fsio_setting(1)
#define RPM_BELOW_USER_SETTING_1 "rpm 1 fsio_setting <"
// starter block using configurable parameter
// Human-readable: rpm < cranking_rpm
#define STARTER_RELAY_LOGIC "rpm cranking_rpm <"
// Human-readable: SCRIPT_TABLE_ (3, rpm, map) / 100
#define BOOST_CONTROLLER "3 rpm map SCRIPT_TABLE_ 100 /"
// Human-readable: if(fsio_analog_input (0) > 20, 0, 10)
#define ANALOG_CONDITION "0 fsio_analog_input 20 > 0 10 if"

View File

@ -1,44 +0,0 @@
#
# in this file we define system FSIO expressions
#
# system_fsio.txt is input for compile_fsio_file tool, see gen_system_fsio.bat
#
# see http://rusefi.com/wiki/index.php?title=Manual:Flexible_Logic
#
# Jan 19, 2017
# Andrey Belomutskiy, (c) 2012-2017
#
TOO_HOT_LOGIC=coolant > 120
# Combined RPM, CLT and VBATT warning light
COMBINED_WARNING_LIGHT=(rpm > fsio_setting(2)) | ((coolant > fsio_setting(3)) | (vbatt < fsio_setting(4)))
# could be used for simple variable intake geometry setups or warning light or starter block
RPM_ABOVE_USER_SETTING_1=rpm > fsio_setting(1)
RPM_BELOW_USER_SETTING_3=rpm < fsio_setting(3)
# could be used for simple variable intake geometry setups or warning light or starter block
RPM_ABOVE_USER_SETTING_1=rpm > fsio_setting(1)
RPM_ABOVE_USER_SETTING_2=rpm > fsio_setting(2)
RPM_ABOVE_5500_ON_OFF=rpm > 5500
RPM_ABOVE_6000_ON_OFF=rpm > 6000
RPM_ABOVE_1000_SOLENOID_70_DUTY=(rpm > 1000) * 0.7
RPM_ABOVE_2000_SOLENOID_50_DUTY=(rpm > 2000) * 0.5
RPM_ABOVE_6000_SOLENOID_80_DUTY=(rpm > 6000) * 0.8
RPM_BELOW_USER_SETTING_1=rpm < fsio_setting(1)
# starter block using configurable parameter
STARTER_RELAY_LOGIC=rpm < cranking_rpm
BOOST_CONTROLLER=fsio_table (3, rpm, map) / 100
ANALOG_CONDITION=if(fsio_analog_input (0) > 20, 0, 10)

View File

@ -1 +0,0 @@
java -jar ../java_console_binary/rusefi_console.jar compile_fsio_file controllers/system_fsio.txt controllers/system_fsio.h

View File

@ -227,11 +227,6 @@ struct_no_prefix engine_configuration_s
#define SCRIPT_CURVE_8 8
#define SCRIPT_CURVE_16 16
#define FSIO_METHOD_FSIO_SETTING "fsio_setting"
#define FSIO_METHOD_FSIO_TABLE "fsio_table"
#define FSIO_METHOD_FSIO_ANALOG_INPUT "fsio_analog_input"
#define FSIO_METHOD_FSIO_DIGITAL_INPUT "fsio_digital_input"
#define TPS_TPS_ACCEL_TABLE 8
#define ADC_CHANNEL_NONE 0
@ -295,7 +290,7 @@ float baseFuel;+Base mass of the per-cylinder fuel injected during cranking. Thi
int16_t rpm;+This sets the RPM limit below which the ECU will use cranking fuel and ignition logic, typically this is around 350-450rpm. \nset cranking_rpm X;"RPM", 1, 0, 0, 3000, 0
end_struct
#define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "GPPWM", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "VVT1 PID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INSTANT_RPM", "INVALID", "Status", "CJ125", "INVALID", "MAP", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "FSIO_COMPOSITE_LOG", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "rusEFI Wideband", "TCU", "Lua", "VVT2 PID", "VVT3 PID", "VVT4 PID", "mode 52", "mode 53"
#define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "GPPWM", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "VVT1 PID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INSTANT_RPM", "INVALID", "Status", "CJ125", "INVALID", "MAP", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "rusEFI Wideband", "TCU", "Lua", "VVT2 PID", "VVT3 PID", "VVT4 PID", "mode 52", "mode 53"
custom debug_mode_e 4 bits, U32, @OFFSET@, [0:5], @@debug_mode_e_enum@@
#define VM_VVT_INACTIVE 0

Binary file not shown.

View File

@ -23,7 +23,6 @@ Bits: 'bits';
Bit: 'bit';
Array: 'array';
Scalar: 'scalar';
FsioVisible: 'fsio_visible';
Autoscale: 'autoscale';
ArrayDimensionSeparator: 'x';
@ -94,7 +93,7 @@ fieldOptionsList
arrayLengthSpec: numexpr (ArrayDimensionSeparator numexpr)?;
scalarField: identifier Autoscale? FsioVisible? identifier (fieldOptionsList)?;
scalarField: identifier Autoscale? identifier (fieldOptionsList)?;
arrayField: identifier '[' arrayLengthSpec Iterate? ']' Autoscale? identifier SemicolonedString? (fieldOptionsList)?;
bitField: Bit identifier (',' QuotedString ',' QuotedString)? ('(' 'comment' ':' QuotedString ')')? SemicolonedSuffix?;

View File

@ -58,8 +58,6 @@
#define BOARD_MC33972_COUNT 0
#define BOARD_TLE8888_COUNT 0
#define EFI_FSIO TRUE
#define EFI_TEXT_LOGGING TRUE
#define EFI_MEMS FALSE

View File

@ -48,8 +48,6 @@
#define DEBUG_INTERPOLATION TRUE
#define EFI_FSIO TRUE
#define EFI_TEXT_LOGGING TRUE
#define EFI_HISTOGRAMS FALSE

View File

@ -8,7 +8,6 @@
#include "pch.h"
#include "event_queue.h"
#include "fsio_impl.h"
using ::testing::_;