From c05376ed5f22659532642c576a05decc094498a7 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 5 Nov 2021 15:25:29 -0400 Subject: [PATCH] lua curve progress --- firmware/controllers/core/fsio_impl.cpp | 12 ++++++++++++ firmware/controllers/core/fsio_impl.h | 1 + 2 files changed, 13 insertions(+) diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 9516d3f062..a352ec3c7d 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -604,6 +604,18 @@ ValueProvider3D *getFSIOTable(int index) { } } +/** + * @return zero-based index of curve with given name + */ +int getCurveIndexByName(const char *name DECLARE_ENGINE_PARAMETER_SUFFIX) { + for (int i = 0;iscriptCurveName[i])) { + return i; + } + } + return EFI_ERROR_CODE; +} + float getCurveValue(int index, float key DECLARE_ENGINE_PARAMETER_SUFFIX) { // not great code at all :( switch (index) { diff --git a/firmware/controllers/core/fsio_impl.h b/firmware/controllers/core/fsio_impl.h index c18b97ca6e..990cdf7322 100644 --- a/firmware/controllers/core/fsio_impl.h +++ b/firmware/controllers/core/fsio_impl.h @@ -39,5 +39,6 @@ void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfigura void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE); float getCurveValue(int index, float key DECLARE_ENGINE_PARAMETER_SUFFIX); +int getCurveIndexByName(const char *name DECLARE_ENGINE_PARAMETER_SUFFIX); ValueProvider3D *getFSIOTable(int index);