mirror of
https://github.com/stevenhowes/MX5-Arduino.git
synced 2026-05-26 15:53:40 +01:00
Calculate as if doing sequential ignition but process as wasted spark. Makes injection easier as it can share the same sequencing.
This commit is contained in:
@@ -44,7 +44,7 @@ void cas_process()
|
||||
{
|
||||
// If we've arrived at cylinder 1 unexpectedly then we need to know!
|
||||
// We'll drop sparks until we're back and log it
|
||||
if(cylinder_next[cylinder_tdc] != 1)
|
||||
if(cylinder_next_seq[cylinder_tdc] != 1)
|
||||
{
|
||||
cas_sync_fail=1;
|
||||
cas_sync_fail_log=1;
|
||||
@@ -60,20 +60,20 @@ void cas_process()
|
||||
}
|
||||
else
|
||||
{
|
||||
cylinder_tdc = cylinder_next[cylinder_tdc];
|
||||
cylinder_tdc = cylinder_next_seq[cylinder_tdc];
|
||||
}
|
||||
|
||||
// Schedule next cylinder, this one is already past TDC
|
||||
cylinder_next_fire = cylinder_next[cylinder_tdc];
|
||||
cylinder_next_fire = cylinder_next_seq[cylinder_tdc];
|
||||
|
||||
// If we're out of sync, we kill ignition for a bit for now. Same if we're at crazy RPM
|
||||
if((cas_sync_fail == 0) && (rpm_limited == 0))
|
||||
{
|
||||
if(cylinder_next_fire == 1)
|
||||
if((cylinder_next_fire == 1) || (cylinder_next_fire == 4))
|
||||
{
|
||||
task_coil1_fire = micros() + (usec_per_degree * (180 + ignition_offset - table_ignition[rpm_current_index + (map_current_index << 4)]));
|
||||
task_coil1_charge = task_coil1_fire - (coil_dwell + table_dwell[battery_voltage_index]);
|
||||
}else if(cylinder_next_fire == 2)
|
||||
}else if((cylinder_next_fire == 2) || (cylinder_next_fire == 3))
|
||||
{
|
||||
task_coil2_fire = micros() + (usec_per_degree * (180 + ignition_offset - table_ignition[rpm_current_index + (map_current_index << 4)]));
|
||||
task_coil2_charge = task_coil2_fire - (coil_dwell + table_dwell[battery_voltage_index]);
|
||||
|
||||
@@ -31,8 +31,8 @@ byte cas_sync_fail_log = 0; // We need to output t
|
||||
// Cylinder sequencing
|
||||
byte cylinder_tdc = 0; // Most recent cylinder to hit TDC
|
||||
byte cylinder_next_fire = 0; // Next cylinder due a spark
|
||||
//byte cylinder_next_inject = 0; // Next cylinder due fuel
|
||||
byte cylinder_next[] = {0,2,1,2,1}; // Can be 0,3,1,4,2 if we ever go sequential
|
||||
byte cylinder_next_inject = 0; // Next cylinder due fuel
|
||||
byte cylinder_next_seq[] = {0,3,1,4,2}; // Sequential
|
||||
|
||||
// Ignition
|
||||
const int coil_dwell = 4000; // 4 read from scope on factory ECU
|
||||
|
||||
Reference in New Issue
Block a user