Speeduino
Loading...
Searching...
No Matches
globals.h
Go to the documentation of this file.
1
25#ifndef GLOBALS_H
26#define GLOBALS_H
27#include "table2d.h"
28#include "table3d.h"
29#include "statuses.h"
30#include "config_pages.h"
31#include "atomic.h"
33
34#define CRANK_ANGLE_MAX (max(CRANK_ANGLE_MAX_IGN, CRANK_ANGLE_MAX_INJ))
35
36#ifndef UNIT_TEST
37constexpr uint8_t TOOTH_LOG_SIZE = 127U;
38#else
39constexpr uint8_t TOOTH_LOG_SIZE = 2U;
40#endif
41
42extern struct table3d16RpmLoad fuelTable; //16x16 fuel map
43extern struct table3d16RpmLoad fuelTable2; //16x16 fuel map
44extern struct table3d16RpmLoad ignitionTable; //16x16 ignition map
45extern struct table3d16RpmLoad ignitionTable2; //16x16 ignition map
46extern struct table3d16RpmLoad afrTable; //16x16 afr target map
47extern struct table3d8RpmLoad stagingTable; //8x8 fuel staging table
48extern struct table3d8RpmLoad boostTable; //8x8 boost map
49extern struct table3d8RpmLoad boostTableLookupDuty; //8x8 boost map
50extern struct table3d8RpmLoad vvtTable; //8x8 vvt map
51extern struct table3d8RpmLoad vvt2Table; //8x8 vvt map
52extern struct table3d8RpmLoad wmiTable; //8x8 wmi map
53
55
56extern trimTable3d trimTables[INJ_CHANNELS]; //6x6 Fuel trim maps
57
58extern struct table3d4RpmLoad dwellTable; //4x4 Dwell map
59
60extern uint8_t softLimitTime; //The time (in 0.1 seconds, based on seclx10) that the soft limiter started
61extern volatile uint16_t mainLoopCount;
62extern volatile unsigned long ms_counter; //A counter that increments once per ms
64extern volatile uint32_t toothHistory[TOOTH_LOG_SIZE];
66extern volatile unsigned int toothHistoryIndex;
67extern unsigned long currentLoopTime;
68extern volatile uint16_t ignitionCount;
71extern volatile uint32_t runSecsX10;
72extern volatile uint32_t seclx10;
75
76extern struct statuses currentStatus; //The global status object
77extern struct config2 configPage2;
78extern struct config4 configPage4;
79extern struct config6 configPage6;
80extern struct config9 configPage9;
81extern struct config10 configPage10;
82extern struct config13 configPage13;
83extern struct config15 configPage15;
84
85bool pinIsOutput(byte pin);
86bool pinIsUsed(byte pin);
87
88#endif // GLOBALS_H
#define INJ_CHANNELS
Definition board_avr2560.h:22
The tune page structs and related defines.
volatile uint16_t ignitionCount
Definition globals.cpp:31
struct table3d8RpmLoad stagingTable
8x8 fuel staging table
Definition globals.cpp:11
struct statuses currentStatus
Definition globals.cpp:39
volatile uint32_t seclx10
Definition globals.cpp:35
constexpr uint8_t TOOTH_LOG_SIZE
Definition globals.h:37
struct table3d8RpmLoad vvt2Table
8x8 vvt2 map
Definition globals.cpp:15
volatile unsigned int toothHistoryIndex
Current index to toothHistory array.
Definition globals.cpp:29
int16_t CRANK_ANGLE_MAX_IGN
Definition globals.cpp:32
unsigned long currentLoopTime
Definition globals.cpp:30
volatile uint32_t runSecsX10
Definition globals.cpp:34
uint16_t fixedCrankingOverride
Definition globals.cpp:24
struct table3d16RpmLoad afrTable
16x16 afr target map
Definition globals.cpp:10
pinNumbers_t pinNumbers
Definition globals.cpp:37
struct table3d16RpmLoad ignitionTable2
16x16 ignition map
Definition globals.cpp:9
bool pinIsOutput(byte pin)
Definition globals.cpp:49
int16_t CRANK_ANGLE_MAX_INJ
The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequ...
Definition globals.cpp:33
struct table3d16RpmLoad fuelTable2
16x16 fuel map
Definition globals.cpp:7
trimTable3d trimTables[INJ_CHANNELS]
Definition globals.cpp:17
struct config15 configPage15
Immediately below max RPM, there is a range within which we can apply a rolling cut.
Definition engineProtection.cpp:286
struct table3d8RpmLoad wmiTable
8x8 wmi map
Definition globals.cpp:16
struct config10 configPage10
Definition corrections.cpp:59
struct table3d4RpmLoad dwellTable
4x4 Dwell map
Definition globals.cpp:18
struct table3d8RpmLoad boostTable
8x8 boost map
Definition globals.cpp:12
struct config9 configPage9
Definition engineProtection.cpp:13
uint8_t softLimitTime
Definition globals.cpp:21
struct table3d16RpmLoad fuelTable
16x16 fuel map
Definition globals.cpp:6
volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]
Definition globals.cpp:26
struct config13 configPage13
Definition globals.cpp:45
volatile unsigned long ms_counter
Definition globals.cpp:23
struct config6 configPage6
Definition corrections.cpp:60
volatile uint16_t mainLoopCount
Definition globals.cpp:22
struct config2 configPage2
Definition corrections.cpp:57
struct table3d8RpmLoad boostTableLookupDuty
8x8 boost map lookup table
Definition globals.cpp:13
volatile uint32_t toothHistory[TOOTH_LOG_SIZE]
Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)
Definition globals.cpp:25
bool pinIsUsed(byte pin)
Definition globals.cpp:85
struct config4 configPage4
Definition corrections.cpp:54
struct table3d16RpmLoad ignitionTable
16x16 ignition map
Definition globals.cpp:8
struct table3d8RpmLoad vvtTable
8x8 vvt map
Definition globals.cpp:14
The statuses struct and related defines.
Definition array.h:14
constexpr array()=default
Definition config_pages.h:649
Definition config_pages.h:845
Definition config_pages.h:894
Definition config_pages.h:175
Definition config_pages.h:355
Definition config_pages.h:454
Definition config_pages.h:571
Store the pin assignments, as defined by the board.
Definition pinNumbers_t.h:40
The status struct with current values for all 'live' variables.
Definition statuses.h:47
3D table data types and functions