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:
Steve Howes
2018-09-14 20:24:47 +01:00
parent b0d2f98594
commit c04e79e81e
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -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]);
+2 -2
View File
@@ -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