To provide improved engine performance, better fuel economy, and reduced exhaust emissions, MegaSquirtII can control spark advance (timing), and this advance is programmable by the user.
For MegaSquirtII (as for most other ignition systems), the total ignition advance is based on three factors:
In particular, MegaSquirtII uses three variables to determine the total advance (called adv_deg).
Note that you specify the total advance in MegaTune. That is, you calibrate the trigger offset, then put the timing you want in the MegaTune advance table. So if you have calibrated your trigger offset (suppose it is 10°), and want 25° BTDC for the advance, you put 25° in the MegaTune table (not 15° or 35°).
In the code, these factors are in tenths of a degree (1/10°). These values must be positive, so adv_offset sets the minimum amount of advance possible.
In general:
The spark advance table is a 12 by 12 matrix (144 values) based on engine RPM and MAP sensor values. A further table of 10 values is used to make adjustments for engine coolant temperature.
[ign_table(rpm,kpa)]
130 | 0.0 | 2.0 | 6.0 | 10.0 | 14.0 | 18.0 | 22.0 | 26.0 | 30.0 | 31.0 | 32.0 | 32.0 | |
120 | 0.0 | 3.0 | 7.0 | 11.0 | 15.0 | 19.0 | 23.0 | 27.0 | 31.0 | 32.0 | 33.0 | 33.0 | |
110 | 0.0 | 4.0 | 8.0 | 12.0 | 16.0 | 20.0 | 24.0 | 28.0 | 32.0 | 33.0 | 34.0 | 34.0 | |
100 | 0.0 | 6.0 | 10.0 | 14.0 | 18.0 | 22.0 | 26.0 | 30.0 | 36.0 | 36.0 | 36.0 | 36.0 | |
90 | 0.0 | 8.0 | 11.0 | 15.0 | 19.0 | 23.0 | 30.0 | 33.0 | 35.0 | 36.0 | 36.0 | 36.0 | |
kPa | 80 | 2.0 | 8.0 | 12.0 | 16.0 | 20.0 | 24.0 | 30.0 | 34.0 | 35.0 | 36.0 | 36.0 | 36.0 |
70 | 4.0 | 8.0 | 12.0 | 16.0 | 20.0 | 24.0 | 30.0 | 34.0 | 35.0 | 36.0 | 36.0 | 36.0 | |
60 | 6.0 | 10.0 | 14.0 | 18.0 | 22.0 | 26.0 | 31.0 | 34.0 | 35.0 | 36.0 | 36.0 | 36.0 | |
50 | 8.0 | 12.0 | 16.0 | 20.0 | 24.0 | 28.0 | 32.0 | 35.0 | 36.0 | 36.0 | 36.0 | 36.0 | |
40 | 8.0 | 14.0 | 18.0 | 22.0 | 26.0 | 30.0 | 34.0 | 36.0 | 38.0 | 38.0 | 39.0 | 40.0 | |
30 | 8.0 | 16.0 | 19.0 | 23.0 | 27.0 | 31.0 | 34.0 | 37.0 | 39.0 | 40.0 | 41.0 | 42.0 | |
20 | 8.0 | 16.0 | 20.0 | 24.0 | 28.0 | 32.0 | 34.0 | 38.0 | 41.0 | 44.0 | 46.0 | 46.0 | |
500 | 750 | 1000 | 1500 | 2000 | 2500 | 3000 | 3500 | 4000 | 4500 | 5000 | 5500 | ||
Spark advance entries in the 12×12 MegaTune spark table are expressed in engine degrees, and can be specified in tenths of a degree (1/10°). Note that they are the actual timing before top dead center (BTDC), and include any trigger offset.