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
35#ifndef UNIT_TEST
36constexpr uint8_t TOOTH_LOG_SIZE = 127U;
37#else
38constexpr uint8_t TOOTH_LOG_SIZE = 2U;
39#endif
40
41extern struct table3d16RpmLoad fuelTable; //16x16 fuel map
42extern struct table3d16RpmLoad fuelTable2; //16x16 fuel map
43extern struct table3d16RpmLoad ignitionTable; //16x16 ignition map
44extern struct table3d16RpmLoad ignitionTable2; //16x16 ignition map
45extern struct table3d16RpmLoad afrTable; //16x16 afr target map
46extern struct table3d8RpmLoad stagingTable; //8x8 fuel staging table
47extern struct table3d8RpmLoad boostTable; //8x8 boost map
48extern struct table3d8RpmLoad boostTableLookupDuty; //8x8 boost map
49extern struct table3d8RpmLoad vvtTable; //8x8 vvt map
50extern struct table3d8RpmLoad vvt2Table; //8x8 vvt map
51extern struct table3d8RpmLoad wmiTable; //8x8 wmi map
52
53using trimTable3d = table3d6RpmLoad;
54
55extern trimTable3d trimTables[INJ_CHANNELS]; //6x6 Fuel trim maps
56
57extern struct table3d4RpmLoad dwellTable; //4x4 Dwell map
58
59extern uint8_t softLimitTime; //The time (in 0.1 seconds, based on seclx10) that the soft limiter started
60extern volatile uint32_t toothHistory[TOOTH_LOG_SIZE];
61extern volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE];
62extern volatile unsigned int toothHistoryIndex;
63extern volatile uint16_t ignitionCount;
64extern volatile uint32_t runSecsX10;
65extern volatile uint32_t seclx10;
68
69extern struct statuses currentStatus; //The global status object
70extern struct config2 configPage2;
71extern struct config4 configPage4;
72extern struct config6 configPage6;
73extern struct config9 configPage9;
74extern struct config10 configPage10;
75extern struct config13 configPage13;
76extern struct config15 configPage15;
77
78bool pinIsOutput(byte pin, const pinNumbers_t &pins);
79static inline bool pinIsOutput(byte pin) { return pinIsOutput(pin, pinNumbers); }
80bool pinIsUsed(byte pin, const pinNumbers_t &pins);
81static inline bool pinIsUsed(byte pin) { return pinIsUsed(pin, pinNumbers); }
82
83#endif // GLOBALS_H
#define INJ_CHANNELS
Definition board_avr2560.h:22
The tune page structs and related defines.
volatile uint16_t ignitionCount
The number of crank degrees that the system track over. Typically 720 divided by the number of squirt...
Definition globals.cpp:28
table3d6RpmLoad trimTable3d
Definition globals.h:53
struct table3d8RpmLoad stagingTable
8x8 fuel staging table
Definition globals.cpp:12
struct statuses currentStatus
Definition globals.cpp:35
volatile uint32_t seclx10
Definition globals.cpp:31
constexpr uint8_t TOOTH_LOG_SIZE
Definition globals.h:36
struct table3d8RpmLoad vvt2Table
8x8 vvt2 map
Definition globals.cpp:16
volatile unsigned int toothHistoryIndex
Current index to toothHistory array.
Definition globals.cpp:27
volatile uint32_t runSecsX10
Definition globals.cpp:30
struct table3d16RpmLoad afrTable
16x16 afr target map
Definition globals.cpp:11
bool pinIsUsed(byte pin, const pinNumbers_t &pins)
Definition globals.cpp:84
pinNumbers_t pinNumbers
Definition globals.cpp:33
struct table3d16RpmLoad ignitionTable2
16x16 ignition map
Definition globals.cpp:10
struct table3d16RpmLoad fuelTable2
16x16 fuel map
Definition globals.cpp:8
bool pinIsOutput(byte pin, const pinNumbers_t &pins)
Definition globals.cpp:45
trimTable3d trimTables[INJ_CHANNELS]
Definition globals.cpp:18
struct config15 configPage15
Immediately below max RPM, there is a range within which we can apply a rolling cut.
Definition engineProtection.cpp:303
struct table3d8RpmLoad wmiTable
8x8 wmi map
Definition globals.cpp:17
struct config10 configPage10
Definition corrections.cpp:57
struct table3d4RpmLoad dwellTable
4x4 Dwell map
Definition globals.cpp:19
struct table3d8RpmLoad boostTable
8x8 boost map
Definition globals.cpp:13
struct config9 configPage9
Definition engineProtection.cpp:15
uint8_t softLimitTime
Definition globals.cpp:22
struct table3d16RpmLoad fuelTable
16x16 fuel map
Definition globals.cpp:7
volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]
Definition globals.cpp:24
struct config13 configPage13
Definition globals.cpp:41
struct config6 configPage6
Definition corrections.cpp:58
struct config2 configPage2
Definition corrections.cpp:55
struct table3d8RpmLoad boostTableLookupDuty
8x8 boost map lookup table
Definition globals.cpp:14
volatile uint32_t toothHistory[TOOTH_LOG_SIZE]
Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)
Definition globals.cpp:23
struct config4 configPage4
Definition corrections.cpp:52
struct table3d16RpmLoad ignitionTable
16x16 ignition map
Definition globals.cpp:9
struct table3d8RpmLoad vvtTable
8x8 vvt map
Definition globals.cpp:15
static fastOutputPin_t pins[_countof(coil_pins_t::_M_elems)]
Definition scheduledIO_direct_ign.cpp:10
The statuses struct and related defines.
Definition config_pages.h:650
Definition config_pages.h:846
Definition config_pages.h:895
Definition config_pages.h:179
Definition config_pages.h:357
Definition config_pages.h:461
Definition config_pages.h:578
Store the pin assignments, as defined by the board.
Definition pinNumbers_t.h:41
The status struct with current values for all 'live' variables.
Definition statuses.h:131
3D table data types and functions