From c82d863caea741a4fa8873180db5dd7977cd0a04 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 7 May 2017 10:30:05 -0400 Subject: [PATCH] miata defaults progress --- firmware/controllers/algo/engine_configuration.cpp | 11 +++++++++++ firmware/controllers/algo/engine_configuration.h | 1 + 2 files changed, 12 insertions(+) diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index bf685e651a..9b7bce0e1c 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -1149,7 +1149,17 @@ void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration) { boardConfiguration->joystickDPin = GPIOD_11; } +void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination) { + // todo: extract a template! + for (int loadIndex = 0; loadIndex < FUEL_LOAD_COUNT; loadIndex++) { + for (int rpmIndex = 0; rpmIndex < FUEL_RPM_COUNT; rpmIndex++) { + destination[loadIndex][rpmIndex] = AFR_STORAGE_MULT * source[loadIndex][rpmIndex]; + } + } +} + void copyFuelTable(fuel_table_t const source, fuel_table_t destination) { + // todo: extract a template! for (int loadIndex = 0; loadIndex < FUEL_LOAD_COUNT; loadIndex++) { for (int rpmIndex = 0; rpmIndex < FUEL_RPM_COUNT; rpmIndex++) { destination[loadIndex][rpmIndex] = source[loadIndex][rpmIndex]; @@ -1158,6 +1168,7 @@ void copyFuelTable(fuel_table_t const source, fuel_table_t destination) { } void copyTimingTable(ignition_table_t const source, ignition_table_t destination) { + // todo: extract a template! for (int k = 0; k < IGN_LOAD_COUNT; k++) { for (int rpmIndex = 0; rpmIndex < IGN_RPM_COUNT; rpmIndex++) { destination[k][rpmIndex] = source[k][rpmIndex]; diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index 6514e91f27..a901143123 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -60,6 +60,7 @@ int getGlobalConfigurationVersion(void); void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration); void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration); +void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination); void copyFuelTable(fuel_table_t const source, fuel_table_t destination); void copyTimingTable(ignition_table_t const source, ignition_table_t destination);