Remove custom datalog file and search path hack now redundant due to fully customisab...
[freeems-vanilla.git] / src / inc / TunableConfigs.h
blobb10994a858c156d375b5276d8f500c654eba06e1
1 /* FreeEMS - the open source engine management system
3 * Copyright 2008-2012 Fred Cooke
5 * This file is part of the FreeEMS project.
7 * FreeEMS software is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * FreeEMS software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
20 * We ask that if you make any changes to this file you email them upstream to
21 * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
23 * Thank you for choosing FreeEMS to run your engine!
27 /** @file
29 * @ingroup allHeaders
30 * @ingroup globalHeaders
31 * @ingroup dataStructures
33 * @brief Struct typedefs for tunable configuration
35 * This file contains both the struct data type definitions and the arrays of
36 * default values for small tables. Place reusable definitions of default table
37 * values in here such that they can be used in multiple tunable table definitions.
39 * You should add your configuration item here if it is best that it is adjusted with
40 * instant results on a running engine. For everything else, please consider placing
41 * it in one of the fixed configuration structs.
45 /* Header file multiple inclusion protection courtesy eclipse Header Template */
46 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
47 #ifndef FILE_TUNABLE_CONFIGS_H_SEEN
48 #define FILE_TUNABLE_CONFIGS_H_SEEN
51 /** Holds a datalog chunk configuration pair.
53 * A datalog configuration pair consists of an address and a size.
55 typedef struct {
56 void* address;
57 unsigned short size;
58 } logChunk;
61 #define MAX_LOG_CHUNKS 16
62 /** Holds all configuration for logging.
64 * These are in tunable config such that the system can pick up where it left
65 * off if reset with settings burned to flash, or simply switch back to default
66 * if changed in ram and not burned and then reset.
68 typedef struct {
69 unsigned char datalogStreamType; ///< Which type of datalog to pump out as fast as we can. @see commsCore.h
70 unsigned char datalogPollingType; ///< Which type of datalog to pump out as fast as we can. @see commsCore.h
71 unsigned char firstChunk; ///< The index of the first chunk to send.
72 unsigned char numberOfChunks; ///< How many chunks to send.
73 logChunk logChunks[MAX_LOG_CHUNKS]; ///< Array of chunk sets so as to have on-board presets available to quickly swap to.
74 void* datalogByteStreamSourceAddress; ///< Where to grab our data from.
75 void* datalogWordStreamSourceAddress; ///< Where to grab our data from.
76 void* datalogLongStreamSourceAddressFirst; ///< Where to grab our data from. If the second address is set to zero, get 4 bytes from this address.
77 void* datalogLongStreamSourceAddressSecond; ///< Where to grab our data from. If this is non-zero, get 2 bytes from the first address and 2 from this address.
78 // TODO scratch pad configs
79 } loggingSetting;
82 #define SMALL_TABLES_1_FILLER_SIZE (flashSectorSize - (sizeof(twoDTableUS) * 8)) // Update this if adding another table!
83 /**
84 * One of four structs of live tunable data such as small tables and fuel trims
85 * etc. If you add something here, please ensure you update all of the following :
86 * - Default values in the initial definitions in TunableConfig.c and TunableConfig2.c
87 * - The address values within the initPagedRAMTune() function in init.c
88 * - The lookupBlockDetails() function in blockDetailsLookup.c
89 * - The JSON data map and other related firmware interface definition files
92 typedef struct {
93 twoDTableUS dwellDesiredVersusVoltageTable; ///< Standard dwell curve dependent on voltage.
94 twoDTableUS injectorDeadTimeTable; ///< Injector dead time curve dependent on voltage.
95 twoDTableUS postStartEnrichmentTable; ///< Unused at this time.
96 twoDTableUS postStartTaperTimeTable; ///< Unused at this time.
97 twoDTableUS engineTempEnrichmentTableFixed; ///< Unused at this time.
98 twoDTableUS primingVolumeTable; ///< @todo TODO define units. perhaps micro litres (cubic milli meters) would be good, 5 - 100 seem to be the norm 327.68 = 65535/200
99 twoDTableUS engineTempEnrichmentTablePercent; ///< Engine temperature enrichment by percent, AKA warmup curve.
100 twoDTableUS dwellVersusRPMTable; ///< Useful for certain setups, will generalise later.
101 unsigned char filler[SMALL_TABLES_1_FILLER_SIZE];
102 } SmallTables1;
105 #define SMALL_TABLES_2_FILLER_SIZE (flashSectorSize - (sizeof(loggingSetting) + 12)) // Update this if adding another table/struct!
106 /** @copydoc SmallTables1 */
107 typedef struct {
108 loggingSetting loggingSettings; ///< @copydoc loggingSetting
109 unsigned short perCylinderFuelTrims[INJECTION_CHANNELS]; ///< Trims for injection, from 0% to 200% of base.
110 unsigned char filler[SMALL_TABLES_2_FILLER_SIZE]; ///< Padding data.
111 } SmallTables2;
114 #define SMALL_TABLES_3_FILLER_SIZE flashSectorSize // Update this if adding a table!
115 /** @copydoc SmallTables1 */
116 typedef struct {
117 unsigned char filler[SMALL_TABLES_3_FILLER_SIZE]; ///< Padding data.
118 } SmallTables3;
121 #define SMALL_TABLES_4_FILLER_SIZE flashSectorSize // Update this if adding a table!
122 /** @copydoc SmallTables1 */
123 typedef struct {
124 unsigned char filler[SMALL_TABLES_4_FILLER_SIZE]; ///< Padding data.
125 } SmallTables4;
128 #else
129 /* let us know if we are being untidy with headers */
130 #warning "Header file TUNABLE_CONFIGS_H seen before, sort it out!"
131 /* end of the wrapper ifdef from the very top */
132 #endif