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

69 lines
2.3 KiB
C
Raw Normal View History

2014-08-29 07:52:33 -07:00
/**
* @file engine_configuration.h
* @brief Main engine configuration data structure.
*
* @date Oct 30, 2013
2015-01-12 15:04:10 -08:00
* @author Andrey Belomutskiy, (c) 2012-2015
2014-08-29 07:52:33 -07:00
*/
#ifndef ENGINE_CONFIGURATION_H_
#define ENGINE_CONFIGURATION_H_
#include "efifeatures.h"
#include "crc.h"
#include "can_header.h"
#include "rusefi_enums.h"
2014-10-31 11:05:18 -07:00
#include "global.h"
2015-01-27 13:04:15 -08:00
#include "rusefi_types.h"
#include "engine_configuration_generated_structures.h"
2014-08-29 07:52:33 -07:00
2014-10-17 13:05:16 -07:00
#define MOCK_UNDEFINED -1
2015-01-23 13:05:07 -08:00
// WARNING: by default, our small enums are ONE BYTE. this one is made 4-byte with the 'ENUM_32_BITS' hack
2014-12-04 05:03:27 -08:00
// 19010105 decimal
2014-09-12 18:05:24 -07:00
#define HEADER_MAGIC_NUMBER 0x1221239
2014-08-29 07:52:33 -07:00
/**
* @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
*/
void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode);
operation_mode_e getOperationMode(engine_configuration_s const *engineConfiguration);
typedef struct {
engine_configuration_s engineConfiguration;
} persistent_config_s;
typedef struct {
int version;
int size;
persistent_config_s persistentConfiguration;
crc_t value;
} persistent_config_container_s;
void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_configuration_s *boardConfiguration);
2014-12-10 06:03:23 -08:00
void setMap(fuel_table_t table, float value);
2014-08-29 07:52:33 -07:00
void setWholeFuelMap(engine_configuration_s *engineConfiguration, float value);
2014-11-03 18:03:13 -08:00
void setWholeTimingTable(engine_configuration_s *engineConfiguration, float value);
2014-08-29 07:52:33 -07:00
void setConstantDwell(engine_configuration_s *engineConfiguration, float dwellMs);
void printFloatArray(const char *prefix, float array[], int size);
void incrementGlobalConfigurationVersion(void);
int getGlobalConfigurationVersion(void);
2014-11-05 09:03:15 -08:00
void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration);
2015-01-07 20:05:00 -08:00
void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration);
2014-11-05 09:03:15 -08:00
2014-12-01 08:04:04 -08:00
void copyFuelTable(fuel_table_t const source, fuel_table_t destination);
void copyTimingTable(ignition_table_t const source, ignition_table_t destination);
2014-08-29 07:52:33 -07:00
#endif /* ENGINE_CONFIGURATION_H_ */