![]() |
Speeduino
|
#include <stdint.h>#include "globals.h"#include "scheduler.h"#include "comms.h"#include "comms_legacy.h"#include "comms_secondary.h"#include "maths.h"#include "corrections.h"#include "timers.h"#include "decoders.h"#include "idle.h"#include "auxiliaries.h"#include "sensors.h"#include "storage.h"#include "crankMaths.h"#include "init.h"#include "utilities.h"#include "engineProtection.h"#include "scheduledIO.h"#include "secondaryTables.h"#include "comms_CAN.h"#include "SD_logger.h"#include "schedule_calcs.h"#include "load_source.h"#include "board_definition.h"#include "unit_testing.h"#include <RTC_LIB_H>#include "units.h"#include "fuel_calcs.h"#include "preprocessor.h"#include "dwell.h"Macros | |
| #define | CRANK_RUN_HYSTER 15 |
| #define | SET_FUEL_CHANNEL(channel) setFuelSchedule(fuelSchedule ##channel, UINT8_C(channel), current.PW ##channel, injectionStartAngles[(channel)-1U], crankAngle, fuelChannelsOn); |
| #define | SET_IGNITION_CHANNEL(channelIdx) setIgnitionChannel(ignitionSchedule ##channelIdx, UINT8_C((channelIdx)), channel ##channelIdx ##IgnDegrees, ignition ##channelIdx ##StartAngle, crankAngle, dwell, ignitionChannelsOn); |
Variables | |
| constexpr table2D_u8_u16_4 injectorAngleTable & | configPage2 |
| constexpr table2D_u8_u8_8 rotarySplitTable & | configPage10 |
| constexpr table2D_u8_u8_10 idleTargetTable & | configPage6 |
Speeduino initialisation and main loop.
| #define CRANK_RUN_HYSTER 15 |
| #define SET_FUEL_CHANNEL | ( | channel | ) | setFuelSchedule(fuelSchedule ##channel, UINT8_C(channel), current.PW ##channel, injectionStartAngles[(channel)-1U], crankAngle, fuelChannelsOn); |
| #define SET_IGNITION_CHANNEL | ( | channelIdx | ) | setIgnitionChannel(ignitionSchedule ##channelIdx, UINT8_C((channelIdx)), channel ##channelIdx ##IgnDegrees, ignition ##channelIdx ##StartAngle, crankAngle, dwell, ignitionChannelsOn); |
|
inlinestatic |


| BEGIN_LTO_ALWAYS_INLINE | ( | void | ) |
Speeduino main loop.
Main loop chores (roughly in the order that they are performed):
single byte variable LOOP_TIMER plays a big part here as:
Sometimes loop() is inlined by LTO & sometimes not When not inlined, there is a huge difference in stack usage: 60+ bytes That eats into available RAM. Adding attribute((always_inline)) forces the LTO process to inline.
Since the function is declared in an Arduino header, we can't change it to inline, so we need to suppress the resulting warning.

Calculate the Ignition angles for all cylinders (based on config2::nCylinders). both start and end angles are calculated for each channel. Also the mode of ignition firing - wasted spark vs. dedicated spark per cyl. - is considered here.


| void checkLaunchAndFlatShift | ( | ) |


Lookup the ignition advance from 3D ignition table. The values used to look this up will be RPM and whatever load source the user has configured.


Lookup the current VE value from the primary 3D fuel map. The Y axis value used for this lookup varies based on the fuel algorithm selected (speed density, alpha-n etc).


|
inlinestatic |


|
inlinestatic |

|
inlinestatic |

|
inlinestatic |


|
constexpr |
|
constexpr |
|
constexpr |