From 22c872d8d81668c64fd673efe49dbfaa83cc4b76 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 14 Nov 2021 10:56:38 -0500 Subject: [PATCH] Epic: Remove FSIO #2928 --- .../controllers/algo/engine_configuration.cpp | 8 ---- firmware/controllers/algo/engine_parts.h | 1 - firmware/controllers/bench_test.cpp | 8 ++-- firmware/controllers/core/fsio_core.cpp | 8 +--- firmware/controllers/core/fsio_impl.cpp | 44 ------------------- .../controllers/engine_cycle/spark_logic.cpp | 6 --- firmware/controllers/lua/lua_hooks.cpp | 2 +- firmware/controllers/system/efi_gpio.h | 1 - 8 files changed, 6 insertions(+), 72 deletions(-) diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 1821f106e2..12d1bc221a 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -150,10 +150,6 @@ static void wipeStrings(DECLARE_ENGINE_PARAMETER_SIGNATURE) { wipeString(engineConfiguration->engineMake, sizeof(vehicle_info_t)); wipeString(engineConfiguration->engineCode, sizeof(vehicle_info_t)); wipeString(engineConfiguration->vehicleName, sizeof(vehicle_info_t)); - - for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { - wipeString(config->fsioFormulas[i], sizeof(le_formula_t)); - } } void onBurnRequest(DECLARE_ENGINE_PARAMETER_SIGNATURE) { @@ -518,10 +514,6 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->sdCardPeriodMs = 50; - for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { - config->fsioFormulas[i][0] = 0; - } - CONFIG(mapMinBufferLength) = 1; CONFIG(startCrankingDuration) = 3; diff --git a/firmware/controllers/algo/engine_parts.h b/firmware/controllers/algo/engine_parts.h index d120860e4c..510126f8d2 100644 --- a/firmware/controllers/algo/engine_parts.h +++ b/firmware/controllers/algo/engine_parts.h @@ -75,7 +75,6 @@ public: class FsioState { public: FsioState(); - float fsioLastValue[FSIO_COMMAND_COUNT]; #if EFI_UNIT_TEST float mockFan = 0; diff --git a/firmware/controllers/bench_test.cpp b/firmware/controllers/bench_test.cpp index eb10ad20f2..2bd2dece3d 100644 --- a/firmware/controllers/bench_test.cpp +++ b/firmware/controllers/bench_test.cpp @@ -147,10 +147,10 @@ static void doTestSolenoid(int humanIndex, const char *delayStr, const char * on static void doBenchTestFsio(int humanIndex, const char *delayStr, const char * onTimeStr, const char *offTimeStr, const char *countStr) { - if (humanIndex < 1 || humanIndex > FSIO_COMMAND_COUNT) { - efiPrintf("Invalid index: %d", humanIndex); - return; - } +// if (humanIndex < 1 || humanIndex > FSIO_COMMAND_COUNT) { +// efiPrintf("Invalid index: %d", humanIndex); +// return; +// } // todo: convert in lua bench test // brain_pin_e b = CONFIG(fsioOutputPins)[humanIndex - 1]; // pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.fsioOutputs[humanIndex - 1], b); diff --git a/firmware/controllers/core/fsio_core.cpp b/firmware/controllers/core/fsio_core.cpp index a5be66503d..468bca7355 100644 --- a/firmware/controllers/core/fsio_core.cpp +++ b/firmware/controllers/core/fsio_core.cpp @@ -204,13 +204,7 @@ FsioResult LECalculator::processElement(const LEElement *element DECLARE_ENGINE_ return vCond != 0 ? vTrue : vFalse; } case LE_METHOD_FSIO_SETTING: { - float humanIndex = pop(LE_METHOD_FSIO_SETTING); - int index = (int) humanIndex - 1; - if (index >= 0 && index < FSIO_COMMAND_COUNT) { - return CONFIG(scriptSetting)[index]; - } else { - return unexpected; - } + return unexpected; } case LE_METHOD_SCRIPT_TABLE_: { float i = pop(LE_METHOD_SCRIPT_TABLE_); diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 4b39406097..58df9442cd 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -79,17 +79,6 @@ CCM_OPTIONAL LEElementPool sysPool(sysElements, SYS_ELEMENT_POOL_SIZE); static LEElement userElements[UD_ELEMENT_POOL_SIZE] CCM_OPTIONAL; -class FsioPointers { -public: - FsioPointers(); - LEElement * fsioLogics[FSIO_COMMAND_COUNT]; -}; - -FsioPointers::FsioPointers() : fsioLogics() { -} - -static FsioPointers state; - static LEElement * fuelPumpLogic; static LEElement * starterRelayDisableLogic; @@ -219,24 +208,6 @@ static void setPinState(const char * msg, OutputPin *pin, LEElement *element DEC } } -/** - * @param out param! current and new value as long as element is not NULL - * @return 'true' if value has changed - */ -static bool updateValueOrWarning(int humanIndex, const char *msg, float *value DECLARE_ENGINE_PARAMETER_SUFFIX) { - int fsioIndex = humanIndex - 1; - LEElement * element = state.fsioLogics[fsioIndex]; - if (element == NULL) { - warning(CUSTOM_FSIO_INVALID_EXPRESSION, "invalid expression for %s", msg); - return false; - } else { - float beforeValue = *value; - *value = calc.evaluate(msg, beforeValue, element PASS_ENGINE_PARAMETER_SUFFIX); - // floating '==' comparison without EPS seems fine here - return (beforeValue != *value); - } -} - /** * this method should be invoked periodically to calculate FSIO and toggle corresponding FSIO outputs */ @@ -268,21 +239,6 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { * open question if heater should be ON during cranking */ enginePins.o2heater.setValue(engine->rpmCalculator.isRunning()); - -#if EFI_ENABLE_ENGINE_WARNING - if (engineConfiguration->useFSIO4ForSeriousEngineWarning) { - updateValueOrWarning(MAGIC_OFFSET_FOR_ENGINE_WARNING, "eng warning", &ENGINE(fsioState.isEngineWarning) PASS_ENGINE_PARAMETER_SUFFIX); - } -#endif /* EFI_ENABLE_ENGINE_WARNING */ - -#if EFI_ENABLE_CRITICAL_ENGINE_STOP - if (engineConfiguration->useFSIO5ForCriticalIssueEngineStop) { - bool changed = updateValueOrWarning(MAGIC_OFFSET_FOR_CRITICAL_ENGINE, "eng critical", &ENGINE(fsioState.isCriticalEngineCondition) PASS_ENGINE_PARAMETER_SUFFIX); - if (changed && float2bool(ENGINE(fsioState.isCriticalEngineCondition))) { - doScheduleStopEngine(PASS_ENGINE_PARAMETER_SIGNATURE); - } - } -#endif /* EFI_ENABLE_CRITICAL_ENGINE_STOP */ } diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 048684ce35..bbbca60125 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -61,9 +61,6 @@ static void fireSparkBySettingPinLow(IgnitionEvent *event, IgnitionOutputPin *ou warning(CUSTOM_OUT_OF_ORDER_COIL, "out-of-order coil off %s", output->getName()); output->outOfOrder = true; } -#if HW_CHECK_SPARK_FSIO - enginePins.fsioOutputs[event->cylinderIndex].setValue(0); -#endif // HW_CHECK_SPARK_FSIO output->setLow(); } @@ -269,9 +266,6 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput } } -#if HW_CHECK_SPARK_FSIO - enginePins.fsioOutputs[event->cylinderIndex].setValue(1); -#endif // HW_CHECK_SPARK_FSIO INJECT_ENGINE_REFERENCE(output); output->setHigh(); } diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index e365b8766f..342a2952ba 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -208,7 +208,7 @@ static P luaL_checkPwmIndex(lua_State* l, int pos) { auto channel = luaL_checkinteger(l, pos); // Ensure channel is valid - if (channel < 0 || channel >= FSIO_COMMAND_COUNT) { + if (channel < 0 || channel >= LUA_PWM_COUNT) { luaL_error(l, "setPwmDuty invalid channel %d", channel); } diff --git a/firmware/controllers/system/efi_gpio.h b/firmware/controllers/system/efi_gpio.h index 6875da5472..c382b0199b 100644 --- a/firmware/controllers/system/efi_gpio.h +++ b/firmware/controllers/system/efi_gpio.h @@ -204,7 +204,6 @@ public: RegisteredNamedOutputPin tachOut; - OutputPin fsioOutputs[FSIO_COMMAND_COUNT]; RegisteredOutputPin triggerDecoderErrorPin; OutputPin sdCsPin; OutputPin accelerometerCs;