2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file engine_configuration.h
|
|
|
|
* @brief Main engine configuration data structure.
|
|
|
|
*
|
|
|
|
* @date Oct 30, 2013
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2019-12-14 12:33:30 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2020-02-26 22:32:26 -08:00
|
|
|
#include "persistent_configuration.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2018-12-24 19:17:13 -08:00
|
|
|
#ifndef DEFAULT_ENGINE_TYPE
|
2019-07-24 19:33:30 -07:00
|
|
|
#define DEFAULT_ENGINE_TYPE DEFAULT_FRANKENSO
|
2018-12-24 19:17:13 -08:00
|
|
|
#endif
|
|
|
|
|
2017-06-11 12:27:23 -07:00
|
|
|
#define CLT_MANUAL_IDLE_CORRECTION config->cltIdleCorrBins, config->cltIdleCorr, CLT_CURVE_SIZE
|
|
|
|
#define WARMUP_CLT_EXTRA_FUEL_CURVE config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE
|
|
|
|
#define IAT_FUEL_CORRECTION_CURVE config->iatFuelCorrBins, config->iatFuelCorr, IAT_CURVE_SIZE
|
|
|
|
#define INJECTOR_LAG_CURVE engineConfiguration->injector.battLagCorrBins, engineConfiguration->injector.battLagCorr, VBAT_INJECTOR_CURVE_SIZE
|
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
#define MOCK_UNDEFINED -1
|
|
|
|
|
|
|
|
float getRpmMultiplier(operation_mode_e mode);
|
|
|
|
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode);
|
|
|
|
|
|
|
|
void prepareVoidConfiguration(engine_configuration_s *activeConfiguration);
|
2019-05-03 15:41:43 -07:00
|
|
|
void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX);
|
2020-10-26 15:15:17 -07:00
|
|
|
void setLambdaMap(lambda_table_t table, float value);
|
2018-01-20 21:12:50 -08:00
|
|
|
/**
|
|
|
|
* See also setLinearCurve()
|
|
|
|
*/
|
2015-07-10 06:01:56 -07:00
|
|
|
void setMap(fuel_table_t table, float value);
|
2019-05-03 15:41:43 -07:00
|
|
|
void setWholeIgnitionIatCorr(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
|
2019-01-10 16:25:07 -08:00
|
|
|
void setFuelTablesLoadBin(float minValue, float maxValue DECLARE_CONFIG_PARAMETER_SUFFIX);
|
2019-05-03 15:41:43 -07:00
|
|
|
void setWholeIatCorrTimingTable(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
|
2019-01-10 18:10:46 -08:00
|
|
|
void setWholeTimingTable_d(angle_t value DECLARE_CONFIG_PARAMETER_SUFFIX);
|
|
|
|
#define setWholeTimingTable(x) setWholeTimingTable_d(x PASS_CONFIG_PARAMETER_SUFFIX);
|
2019-05-03 15:41:43 -07:00
|
|
|
void setConstantDwell(floatms_t dwellMs DECLARE_CONFIG_PARAMETER_SUFFIX);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2017-05-30 10:50:33 -07:00
|
|
|
// needed by bootloader
|
2019-04-28 20:42:49 -07:00
|
|
|
void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
2019-07-24 18:24:39 -07:00
|
|
|
|
2019-04-28 20:42:49 -07:00
|
|
|
void setDefaultSdCardParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
2017-05-30 10:50:33 -07:00
|
|
|
|
2020-07-05 08:16:07 -07:00
|
|
|
void onBurnRequest(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2017-05-15 20:33:22 -07:00
|
|
|
void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2019-01-09 21:56:08 -08:00
|
|
|
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration);
|
|
|
|
void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2020-07-29 19:48:41 -07:00
|
|
|
#define MEMCPY(dest, src) {memcpy(dest, src, sizeof(src));}
|
|
|
|
|
2019-08-08 19:12:51 -07:00
|
|
|
void emptyCallbackWithConfiguration(engine_configuration_s * engine);
|
2019-11-03 14:17:43 -08:00
|
|
|
void setDefaultFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
2019-08-08 19:12:51 -07:00
|
|
|
|
|
|
|
typedef void (*configuration_callback_t)(engine_configuration_s*);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
// because of 'Logging' class parameter these functions are visible only to C++ code but C code
|
2021-03-25 15:16:26 -07:00
|
|
|
void loadConfiguration(Logging* logger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2019-08-08 19:12:51 -07:00
|
|
|
void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2019-08-08 18:27:57 -07:00
|
|
|
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
|
2021-03-30 04:28:22 -07:00
|
|
|
|
|
|
|
void rememberCurrentConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
2019-08-08 19:12:51 -07:00
|
|
|
#endif /* __cplusplus */
|
2020-04-25 21:07:59 -07:00
|
|
|
|
2021-03-31 11:46:50 -07:00
|
|
|
void setBoardDefaultConfiguration(void);
|
|
|
|
void setBoardConfigOverrides(void);
|
|
|
|
|
|
|
|
// TODO: remove me
|
|
|
|
#define CONFIG_OVERRIDE(__x__) CONFIG(__x__)
|