rusefi-1/firmware/controllers/algo/engine_configuration.h

89 lines
3.6 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file engine_configuration.h
* @brief Main engine configuration data structure.
*
* @date Oct 30, 2013
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-07-10 06:01:56 -07:00
*/
#ifndef ENGINE_CONFIGURATION_H_
#define ENGINE_CONFIGURATION_H_
#include "global.h"
2018-09-16 19:00:14 -07:00
#include "crc.h"
2015-07-10 06:01:56 -07:00
#include "engine_configuration_generated_structures.h"
2019-01-27 21:44:30 -08:00
#include "globalaccess.h"
#include <functional>
2015-07-10 06:01:56 -07:00
2018-12-24 19:17:13 -08:00
#ifndef DEFAULT_ENGINE_TYPE
#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
// WARNING: by default, our small enums are ONE BYTE. this one is made 4-byte with the 'ENUM_32_BITS' hack
/**
* @brief Engine configuration.
* Values in this data structure are adjustable and persisted in on-board flash RAM.
*
* The offsets are tracked using
* https://docs.google.com/spreadsheet/ccc?key=0AiAmAn6tn3L_dGJXZDZOcVVhaG9SaHZKU1dyMjhEV0E
*
* todo: currently the fields here are simply in the order in which they were implemented
* todo: re-arrange this structure one we have a stable code version
*/
float getRpmMultiplier(operation_mode_e mode);
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode);
typedef struct {
int version;
int size;
persistent_config_s persistentConfiguration;
crc_t value;
} persistent_config_container_s;
void prepareVoidConfiguration(engine_configuration_s *activeConfiguration);
void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX);
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2016-06-29 21:02:57 -07:00
void setAfrMap(afr_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);
void setWholeFuelMap(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
void setWholeIgnitionIatCorr(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
void setFuelTablesLoadBin(float minValue, float maxValue DECLARE_CONFIG_PARAMETER_SUFFIX);
void setWholeIatCorrTimingTable(float value DECLARE_CONFIG_PARAMETER_SUFFIX);
void setWholeTimingTable_d(angle_t value DECLARE_CONFIG_PARAMETER_SUFFIX);
#define setWholeTimingTable(x) setWholeTimingTable_d(x PASS_CONFIG_PARAMETER_SUFFIX);
void setConstantDwell(floatms_t dwellMs DECLARE_CONFIG_PARAMETER_SUFFIX);
2015-07-10 06:01:56 -07:00
void printFloatArray(const char *prefix, float array[], int size);
// needed by bootloader
2019-04-28 20:42:49 -07:00
void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE);
2019-04-28 20:42:49 -07:00
void setDefaultSdCardParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);
2018-03-04 18:32:48 -08:00
void rememberCurrentConfiguration(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
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration);
void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration);
2015-07-10 06:01:56 -07:00
2017-05-07 07:30:05 -07:00
void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination);
2015-07-10 06:01:56 -07:00
void copyFuelTable(fuel_table_t const source, fuel_table_t destination);
void copyTimingTable(ignition_table_t const source, ignition_table_t destination);
void resetConfigurationExt(Logging * logger, std::function<void(Engine *)>, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX);
void emptyCallbackWithEngine(Engine * engine);
2015-07-10 06:01:56 -07:00
#endif /* ENGINE_CONFIGURATION_H_ */